I have an acceed db where I am passing UID (User ID) from one form to
another. I need that to do a SQL statement to select records that are
assigned to the UID. Here is my code and it works sometimes but not
all the time. For instance when I log in as user 1 and it works but
then I changed to user 2 and the first time I go in it does not work
but the second time it works. It would appear that the sql statement
is not running everytime. Can anybody help PLEASE!!!!
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