Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing an unbound text box into a query to retrieve records. 1

Status
Not open for further replies.

Data69

Technical User
Jan 24, 2003
24
0
0
US
I have a form that allows me to enter a problem ticket "P0000000" into an unbound text box. I have the form query a table to see if the record exists. if the record exists than I receive a message to enter another Problem. If the record doesn't exist I want to pass the unbound text box into a seperate query. CMy problem is can this be done and if so how? Can anyone help.
 
A query can refer to any control on a form, whether bound or not.

MyGuy = Forms!{Your-form-name-here}!{Your-control-name-here}.VALUE

(I think you need to use the VALUE property to grab the contents of an UNBOUND control, but not sure. I'm doing this off the top of my head.)

If you're using this value as a criteria, just type the above (minus the "myguy" part) in the criteria cell.

If you want to the the value that's up on the form as an expression, just type the above as an expression :

MyGUY: Forms!{your-form-name-here....

This should get you started.

JMH


Me? Ambivalent? Well, yes and no....
Another free Access forum:
More Access stuff at
 
do not use value
the rest should work fine
but dont forget the form has to be open and a value selected otherwise access will be asking you to type the value Christiaan Baes
Belgium
"What a wonderfull world" - Louis armstrong
 
I've also found that not only does the form have to be open, it can't be embedded in another form. If it is, apparently it isn't actually in the forms collection and the query won't be able to find it. That's been my experience, anyway. If there is a way around this, I'd love to hear about it.
 
I figured it out by using the following:

DoCmd.OpenForm "hotswapevent", , , "[number] = '" & Me![number] & "'"

My problem was that the form I was passing the parameter to also had a criteria set and I was actually being prompted for the number twice. Thanks for your input.
 
coco86 if by embedded form you mean subform

then try this

forms!formname!subformname.form!controlname Christiaan Baes
Belgium
"What a wonderfull world" - Louis armstrong
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top