Passthrough Query

  • Thread starter Thread starter Angel G
  • Start date Start date
A

Angel G

I have a form in a project DB that its source is a view (csp_UserNames) that
accepts parameters,but I would like to pass a parameter that the user types
in the form itself (USRNAME field) and then requery the form. If I put the
following in its source it works;
Exec csp_UserNames
This returns all values in the users table
If I put:
Exec csp_UserNames alopez
It returns user angel lopez (the login ID is alopez for this user)
But I would like to pass the value in my form (Login_frm) field (USRNAME) to
the parameter so that when I type jsmith in the USRNAME field (afterupdate)
I would just do a Requiery of the form.
Any ideas?
 
Try rewriting the SQL of the passthrough query once you know the user id.
Something like:

Private Sub USRNAME_AfterUpdate()

CurrentDb.QueryDefes("csp_UserNames").SQL = _
"Exec csp_UserNames '" & Me.USRNAME & "'"

End Sub
 
Back
Top