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

Use Bookmark to populate a fom 1

Status
Not open for further replies.

hceonetman

Technical User
Mar 16, 2001
92
US
I haven't seen this anywhere else, not sure why it doesn't work. I want to open a form with an underlying user table, then run a module to get the current username from the operating system, position on that user's record, then hide the form and proceed to a menu. This way I can refer back to values on the opening form at any time and it's transparent to the user. The code to get user name works, but I get an "Invalid use of me keyword" error. I suspect it's due to executing code before the form is open. I've moved the event code from 'On Open' to 'On Load' and 'On Current' with the same result. The code is:

Dim rs As Object
Set rs = Me.Recordset.Clone
rs.findfirst "[UserName] = '" & LUserName & "'"
Me.Bookmark = rs.Bookmark

I was hoping to use the invisible form as an alternative to global variables. Any ideas?
Thanks,
HCEONETMAN
(Witty remark goes here)
 
Why not simply this ?
Forms![your main form].Recordset.FindFirst "[UserName]='" & LUserName & "'"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV,
Worked like a charm. I unfortunately don't do enough vba coding to remember all the tricks from one time to the next.
Thanks again.
HCEONETMAN
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top