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!

Getting info into form from query based table

Status
Not open for further replies.

cppiston

Programmer
Feb 27, 2002
23
0
0
US
Hello,
I have a form, and a make-Table Query, the query uses two combo boxes from the form to get the query info.

Question: I need the query to automatically run when the second combo box is chosen, also, how can my text boxes is the same form use this data from the make-table query as its default data. The text boxes have a different control source (another Table)??
 
cppiston,
Take a look at the DoCmd function in the Visual Basic window(type docmd an highlight it, then press F1).

In the AFTER UPDATE event of the Combo Box Control put this:

-------------------------------------------
Private Sub cboMyControlName_AfterUpdate()

On Error goto Err_cboMyControlName

'run the query
DoCmd.OpenQuery "MyQueryNameSurroundedByQuotes"


'close the query
DoCmd.Close acQuery, "MyQueryNameSurroundedByQuotes"


Err_cboMyControlName:
'your error code should be put here
End Sub
--------------------------------------------

This is NOT an efficient way to do this, but it is easy. I am sure that a helpful poster with more time will put a better way. Until then, this is functional and should be easy to implement.

As far as the second question, I am not sure I fully understand what your are asking? "how can my text boxes is the same form use this data from the make-table query as its default data"???
Do you mean "in the same form...??"

Hope it was helpful [pipe] JerseyBoy
Remember: self-praise is no recommendation
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top