Value from an input box

  • Thread starter Thread starter Daniel
  • Start date Start date
D

Daniel

In A VBA module I have some sql that runs, I'm trying to
get it so an the user is prmpted to enter a value so a
recordet can be created. Everything seems to be runnong
fine, the input box comes up but when then sql in the
recordet runs at doesn't seem to be picking up the vlue
enterd in the input box:
Below is an example from the sql string hte Name should
be

& " HAVING ((([" & sourcetable & "].DAT) Between " &
StartDate & " And " & EndDate & ") AND (([" & sourcetable
& "].CODE)=" & Name & "));"

derived from the iputbox whixh comes before the sql
string in the module:
Name = InputBox(Message, Title)

Any ideas anyone. Be greatful for some help.

Cheers

Daniel
 
Daniel

One thought -- the word "Name" is a reserved word in Access. Many objects
in Access have a "name". Consider using a different term.
 
Have you previously declared "Name" as a public variable and dimensioned it
as a "string"? It should work as you describe. Failing that, one common
solution is to present a form (with unbound control(s) for user input, then
simply read the values on the form.
-Ed
 
Back
Top