Connecting Tech Pros Worldwide Forums | Help | Site Map

using variables in query

Newbie
 
Join Date: Jun 2006
Posts: 1
#1: Jun 20 '06
I am trying to use a combo box to set a variable, and then refresh the form using that variable when the combo box is changed. I've used the following method before, but must be forgetting something else I need to do. What is it.
THe combo box has the following when it is changed

Private Sub Combo43_Change()
Userrname = Me.Combo43.Text
DoCmd.Close
DoCmd.OpenForm "Entry 2"

Exit_Combo43_Change:
Exit Sub

When i run it i get a message which says 'undefined function getuserrname in expression.
What do I need to do?

In the query, the column I want to use the value in is
getuserrname()

PEB's Avatar
PEB PEB is offline
Expert
 
Join Date: Aug 2006
Location: Bulgaria
Posts: 1,380
#2: Sep 3 '06

re: using variables in query


Hi,

And the function getusername() where is it placed?

And other question is this function depends on the content on which record or no?
msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 10,885
#3: Sep 3 '06

re: using variables in query


If Username in your query gets its value from getusername() is it actually a field in a table. Have a look in your modules for this function. What is it doing?

Quote:

Originally Posted by davidmarks

I am trying to use a combo box to set a variable, and then refresh the form using that variable when the combo box is changed. I've used the following method before, but must be forgetting something else I need to do. What is it.
THe combo box has the following when it is changed

Private Sub Combo43_Change()
Userrname = Me.Combo43.Text
DoCmd.Close
DoCmd.OpenForm "Entry 2"

Exit_Combo43_Change:
Exit Sub

When i run it i get a message which says 'undefined function getuserrname in expression.
What do I need to do?

In the query, the column I want to use the value in is
getuserrname()

Reply