SQL on Form Load

J

jdamon1

I have a form where I am passing the user log on from the previous
form. I want to load the next form based upon the User ID. I passed
the variable over and the statement works but if I log out and log on
as a different user the first user data shows up. Then if I log out
and log back in as the second user again it works. Here is my code.

Dim UID As String

UID = GetTagFromArg(Me.OpenArgs, "value")

Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim varItem As String
Dim strCriteria As String
Dim strSQL As String


Set db = CurrentDb()
Set qdf = db.QueryDefs("que_Sales_rep")
db.QueryDefs.Refresh
strCriteria = "'" & UID & "'"

strSQL = "select * from [SAL_Sales Tracking Data] where [SAL_Sales
Tracking Data].[Assigned To] =(" & strCriteria & "); "
qdf.SQL = strSQL


Set db = Nothing
Set qdf = Nothing

Can anybody help me out.
 

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