Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old December 22nd, 2003, 06:35 PM
Stev Stev is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Queensland, Australia
Posts: 256 Stev User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 53 sec
Reputation Power: 7
Reference a single instance of a control on continuous form

I want to reference a particular instance of a control which is on a form formatted as a continuous form. The only way I can see to do it is to cycle through all the controls on the form until I find the Index for the one I want. This seems to be combersome (about 100 controls) and it would have to be repeated frequently.

Reply With Quote
  #2  
Old December 23rd, 2003, 08:22 AM
supersubra's Avatar
supersubra supersubra is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Coimbatore, India
Posts: 281 supersubra User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 16 m 17 sec
Reputation Power: 7
Private Sub FindRecordinContinuousForm(SearchField, SearchValue As String)
'replace above line with searchvalue as long if datatype is long
'and so on
Dim rst As Recordset, strCriteria As String
'if string use next line
strCriteria = "[" & SearchField & "] Like '" & SearchValue & "'"
'else use the next line
' strCriteria = "[" & SearchField & "] Like " & SearchValue
Set rst = Me.RecordsetClone
rst.FindFirst strCriteria
If rst.NoMatch Then
MsgBox "No entry found"
Else
Me.Bookmark = rst.Bookmark
End If
End Sub

call the above function like
if the field you want to search is itemid, value you search is 'ironbar' and if the datatype is string
call FindRecordinContinuousForm("ItemID","ironbar")

you can place the above line on any click event of a button or as you wish.
__________________
V.Subramanian

Reply With Quote
  #3  
Old December 23rd, 2003, 03:35 PM
dandgard dandgard is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Bremerton WA
Posts: 5 dandgard User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
you can also try this

Dim rs As DAO.Recordset
Dim ival As Integer
'
'If we are not adding a new record then we want to see if the user has
'selected a particular item on the main form. If so then go to that record.
'
If Not (Me.NewRecord) Then
Set rs = Me.RecordsetClone
If rs.AbsolutePosition = -1 Then
Else

If Not IsNull(Forms!mnuMain!lstItems) Then
rs.FindNext ("ItemNbr = " & Forms!mnuMain!lstItems.Column(1))
ival = rs.AbsolutePosition
DoCmd.GoToRecord , , acGoTo, ival + 1

End If
End If
End If
rs.Close

you can set a recordsetclone for the underlying recordset for the form.

Then do a findnext where the field (ItemNbr) is equal to a specific value (Forms!mnuMain!lstItems.Column(1)))

This returns the absolute position of the record in the recordset and by adding 1 you get the actual position to goto. Once the record is set you can address the underlying data in the table by referencing the field names in the form.

You can also get data from any record without the gotorecord because you have that info available once you have done the recordsetclone. When you do the findnext the information for that record is available just by referencing the field names in the underlying table or query for the form.

Reply With Quote
  #4  
Old December 23rd, 2003, 04:27 PM
Stev Stev is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Queensland, Australia
Posts: 256 Stev User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 53 sec
Reputation Power: 7
Thanks for the replies.

I will go through the samples for some ideas but you might have misunderstood the question. The samples seem to relate to finding records. What I need to reference are the controls so that I can alter their formatting. Conditional formating can get me part of the way but it is not available in Access97 anyway.

Reply With Quote
  #5  
Old December 23rd, 2003, 06:01 PM
dandgard dandgard is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Bremerton WA
Posts: 5 dandgard User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I see. You can't do that. In a continuous form there is only one instance of the control that is accessible and if you change it you change all of the copies.

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > Reference a single instance of a control on continuous form


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 8 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek