text field to variable

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that asks the user to input their name,manager,territoy. This
is done by text fields. I then have a button that calls a function (ie.
Main().

What I want to happen
I want the user to input the information in the 3 text fields, then when
they push the OK button, it takes the their information and associates it
with some variables so that I can use it in my public function, main().

Right now in the properties of the text fields I have the names set to
txtName
txtManager
txtTerritory

However, I have them as Unbound (which is where I am thinking my mistake
might be)

Any ideas?
 
Your Function Main() just has to set those variables...
Dim varName as String, varManager as String, varTerritory as String
varName = Me.txtName
varManager = Me.txtManager
varTerritory = Me.txtTerritory
hth
Al Camp
 
Thanks!!!

AlCamp said:
Your Function Main() just has to set those variables...
Dim varName as String, varManager as String, varTerritory as String
varName = Me.txtName
varManager = Me.txtManager
varTerritory = Me.txtTerritory
hth
Al Camp
 
I am still having some problems, Access gives me an error

Invalid use of keyword Me!

Any ideas
 
The Me.txtName refers to fields on your form where the Name value is
entered. I take it you have a form where these values are entered, and then
you run a function in that form's module that uses those values as variable
in further operations.
If this next suggestion doesn't work... send more detail of what you've
setup, (form? fieldnames? Event Procedure code? ..etc.)

Try this instead...
varName = [txtName]
varManager = [txtManager]
varTerritory = [txtTerritory]

hth
Al Camp
 
James,
On further thought, please try this also...
varName = Forms!frmYourFormName.txtName
varManager = Forms!frmYourFormName.txtManager
varTerritory = Forms!frmYourFormName.txtTerritory
hth
Al Camp
 
Back
Top