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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

recordset and query code help

Status
Not open for further replies.

bluesage

Programmer
Apr 27, 2004
26
CH
hi,

i want to use a dynamic query but instead of opening it once it is executed, i want the result to be displayed in a text box.

i would also like to know if anyone can tell me how to write code to select just a field from a recordset (is recordset = query ?). example:

i have a query with three names bob, frank, sara.

i want to select just bob from the query and put it in a textbox on my form.

(i know i could use, the record source and the wizard) BUT:
i need to do by means of code, because i plan on having three buttons. when button one is clicked, it selects the first person from the query and displays his name in the textbox. and then button two does the same but for the second person in the same query.

i hope you understand my questions?

in other words: is it possible to do something similar to this:

textboxname = forms!formname!lstboxname.itemdata(1)

BUT with a query? or recordset?

thanks
 
Why don't ypu create a combo box with all 3 names and according to the value of your combo box you will do your code why 3 different command buttons for each name.

 
ok, why not but what does the code look like? what if i want to use a saved query?

thanks
 
In the criteria of your query point to the combo box of your form

lets say your combo box name is NameCombo

then you will point to it in the query criteria

forms!formname!NameCombo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top