will not go to record

A

Afrosheen

I have a toggle button set up so when I press it it is supposed to open a pop
up form and go to the record that is displayed. The pop up form is just an
extension of the main form. I have the staff id, first name and last name
displayed to make sure that it's on the correct record, but it never goes to
the selected record. Here is the code.

Dim stlinkcritera As String
Dim strdocname As String

strdocname = "frm_train"
stlinkcritera = "[staffid] = " & Me![StaffId]
MsgBox StaffId & stlinkcritera
Static fld As Boolean
If fld Then 'this will activate the training form
DoCmd.OpenForm strdocname, , , stLinkCriteria
fld = False
Else 'This will deactivate the training form
DoCmd.Close acForm, strdocname
fld = True
End If

According to the message box it displays the correct staff id. It just
doesn't go to that record. It always goes to the first record.

the first record staffid is 2. If I select staffid 8 it still goes to the
number 2 staffid

I hope I gave you enough information.

Thanks for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top