Form Filtering Help

rat_b76

Registered User.
Local time
Today, 21:40
Joined
May 20, 2003
Messages
37
Hi All,

I know this sounds familiar, however I have searched for about 4 hours and have picked up little pieces of info here and there.

Here is my problem;

I have a login screen which searchs a table for accepted users. From this it picks up the Name of the user and stores it in a UName variable. What I have done is placed this code in order to filter the next form (RequestGUI) to show the records only pertaining to that specific user;
Code:
10 Dim strLinkCriteria
strLinkCriteria = "[Name] =" & UName
DoCmd.OpenForm "RequestGUI", , , strLinkCriteria
It works, however, it requests that I enter the Uname component through an input box (query type)?

What am I doing wrong, can anybody help.

Cheers & Beers
rat_b76
 
Rat,

First, you probably need single-quotes because Name is
probably a string. Secondly, I don't even think that Name is
legal, its probably reserved, and definitely not descriptive.
Third, it brings up the input box because it does not know
what UName is. If you type Me. does the drop-down list
show UName?

Straighten out the name thing and you're there!

Code:
Dim strLinkCriteria

strLinkCriteria = "[Name] ='" & Me.UName & "'"

DoCmd.OpenForm "RequestGUI", , , strLinkCriteria

Wayne
 
Hi Wayne,

Thanks, glarinly obvious mistake, the string in single commas was the golden tip.

Thanks Heaps, disaster averted.

Cheers & Beers
rat_b76
 

Users who are viewing this thread

Back
Top Bottom