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

Combo box query

Status
Not open for further replies.

poporacer

Programmer
Oct 2, 2007
53
US
I have a form (frmIntelInfo) that has a combo box that I want to populate with data from a table (tblAKA) that is filtered by the text in a textbox (txtID) that is on the form. It seem like the query for the combo box might be activated prior to the query for the form so there is never any info for the query. The combo box does not populate with anything. I have the properties for the combo box to populate via the query:
SELECT tblAKA.ID, tblAKA.AKA
FROM tblAKA
WHERE (((tblAKA.ID)=([Forms]![frmIntelInfo]![txtID].[text])))
ORDER BY tblAKA.AKA;

Any suggestions?
 
Try on the AfterUpdate of the textbox:
Me![ComboboxName].Requery
Me![ComboboxName].SetFocus
Me![ComboboxName].DropDown
 
The After Update event does not fire until the user changes data, so this event never fires...I tried something similiar on the after update event for the form as well as the after render and a couple of things...same thing....any other ideas?
 
After further review it seems like the query is not working properly but I am not sure why??? Here is what I found out....I put a break point in the on open event of the form and in the immediate window I looked at the contents of the text box and it was populated with the ID??? I also checked in the immediate window what the contents of the query, [Forms]![frmIntelInfo]![txtID] and it too printed the proper ID...
Are you stumped yet?
 
In the current event procedure of the form:
Me![combo name].RowSource = "SELECT ID, AKA FROM tblAKA WHERE ID=" & Me!txtID & " ORDER BY AKA"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top