Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

combo box question

Status
Not open for further replies.

HandJT

Technical User
Jun 23, 2004
84
US
I have a combo box that lists different values based on a search. I would like Access to display the contents of each record listed in the combo box on the same form. I have in the After Update procedure of the combo box the following code, however it doesn't work. Can anybody tell me what I am doing wrong?

Sub NDW_AfterUpdate()
'Find the record that matches the control

Me.RecordSetClone.FindFirst "[NDW] = " & Me![NDW]
Me.Bookmark = Me.RecordSetClone.Bookmark
End Sub
 
How are ya HandJT . . . . .
[blue]I have in the After Update procedure of the combo box the following code, [purple]however it doesn't work[/purple][/blue]
The code appears legit. Are you sure NDW of the combobox selection is in the resordset of the form?

Calvin.gif
See Ya! . . . . . .
 
Yes and it gives me a runtime error message of 7951: You entered an expression that has an invalid reference to the Recordset Clone property. Not sure what that means and why this code would give me that. Any suggestions?
 
HandJT . . . . .

Try this:
Code:
[blue]   Dim rst As DAO.Recordset
   
   Set rst = Me.RecordsetClone
   
   rst.FindFirst "[NDW] = " & Me![NDW]
   Me.Bookmark = rst.Bookmark
   
   Set rst = Nothing[/blue]
You do realize the code takes no action if the search fails?

Calvin.gif
See Ya! . . . . . .
 
Still giving me the same error. I don't know what the problem is.
 
If NDW is text, you need to change this...
Me.RecordSetClone.FindFirst "[NDW] = " & Me![NDW]

to this...
Me.RecordSetClone.FindFirst "[NDW] = '" & Me![NDW] & "'"



Randy
 
Does the form have a recordset (a table or query as recordsource)?

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top