finding a record in a table from a form (1 Viewer)

smartenuk

Registered User.
Local time
Today, 03:49
Joined
May 14, 2010
Messages
18
I am desperate at this point, I have looked everywhere and I know it is something simple but I need help. I am a novice at access and am trying this because no one else will.

I am in a form that uses a table and I need to look up a record that matches a particular field. The table is "tblVolunteers" the table key is "Volunteers_ID" and I need to find a record whose key matches text box "VolID". Any help would be appreciated
 

smartenuk

Registered User.
Local time
Today, 03:49
Joined
May 14, 2010
Messages
18
I need to do the lookup "on Load" of the form.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 03:49
Joined
Aug 30, 2003
Messages
36,134
There would be no value in the textbox when the form loaded, so no way for it to filter. If the value comes from a different form, the first option should work.
 

smartenuk

Registered User.
Local time
Today, 03:49
Joined
May 14, 2010
Messages
18
thanks again. I did look up your page and I have tried them with no luck yet.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 03:49
Joined
Aug 30, 2003
Messages
36,134
If you get stuck, post your code and the relevant data types.
 

smartenuk

Registered User.
Local time
Today, 03:49
Joined
May 14, 2010
Messages
18
I get the error message " The expression you entered refers to an object that is closed or doesn't exist"
 

smartenuk

Registered User.
Local time
Today, 03:49
Joined
May 14, 2010
Messages
18
is there some way I can send you what I have, posting it has too much in it
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 03:49
Joined
Aug 30, 2003
Messages
36,134
Well, you didn't post the code, but presumably the form you're referring to in it isn't open.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 03:49
Joined
Aug 30, 2003
Messages
36,134
Likely all I need is the code this bit is in, and what object it's in.
 

smartenuk

Registered User.
Local time
Today, 03:49
Joined
May 14, 2010
Messages
18
I am trying this
DoCmd.GoToRecord "Volunteer_ID" = Me.volid
volid is a number that I need the table to go to
 

smartenuk

Registered User.
Local time
Today, 03:49
Joined
May 14, 2010
Messages
18
btw, the value I am trying to use as the lookup key, VolID is a tempvar
 

smartenuk

Registered User.
Local time
Today, 03:49
Joined
May 14, 2010
Messages
18
Bookmark looks as my best chance. how do I code this line:
lngBookmark = Me.[TempVars]![VolID]
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 03:49
Joined
Aug 30, 2003
Messages
36,134
I haven't used TempVars, but it looks like the syntax is

lngBookmark = TempVar!VolID
 

smartenuk

Registered User.
Local time
Today, 03:49
Joined
May 14, 2010
Messages
18
tried it as you wrote and also replaced the tempvar with a txtField and still couldn't get it to work, but thanks a lot for the effort. Still have to get this done by Monday.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 03:49
Joined
Aug 30, 2003
Messages
36,134
Hard to help when you don't post the code. Or the db.
 

smartenuk

Registered User.
Local time
Today, 03:49
Joined
May 14, 2010
Messages
18
Thank You, Thank You. You saved my life with the BOOKMARK app. I was up most of the night troubleshooting the code only to finally find that I had a fat-finger hiccup in your answer causing the errors. Once I moved the tempvar to a txt file it worked.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 03:49
Joined
Aug 30, 2003
Messages
36,134
Glad it worked for you!
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 06:49
Joined
Feb 19, 2002
Messages
43,515
@smartenuk,
You made this much harder than you needed to. Paul's first suggestion to use an unbound combo and let Access build it was essentially a no code colution.
 

Users who are viewing this thread

Top Bottom