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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DoCmd. GoToRecord Error ?????

Status
Not open for further replies.

vistor

Technical User
Dec 22, 2000
164
US
Hi,

I have the following code on an unbound form, on the lost focus of a combo box. This works fine the first time the db is opened and user does a search. Pull down works, goes to correct record on the staff form, but if you go back to the find form to do another search, the combo box no longer will let the user make a choice. A Error 2498 generates. Code follows. Any ideas?

Private Sub cmboStaff_LostFocus()

Dim i

i = Forms!frmfind!cmboStaff.Value
DoCmd.GoToRecord acDataForm, "frmStaff", acGoTo, i

End Sub
 
Sorry, I'm New to VB, thus the bad code. Do you mean close the database application on the user?
 
It's a stand alone application, not split, not web. Forms are in the ap with the tables, macros, etc.
 
Hi,

Try putting your code into the ON Click event of the combobox on your frmFind. You don't need to use the i variable.

DoCmd.GoToRecord acDataForm, "frmStaff", acGoTo, Me!cmboStaff.Value

Have a good one!
BK
 
BK,

I've put the code on the onclick event, but when I make a choice I get an error message saying the staff form isn't open.

How do I get the staff form to open? This is why I had put the code on the Lost Focus event and I had a macro to open the staff form on the On Click event.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top