Using field value in a RowSource query

M

Mike Matheny

I am trying to populate a combo box with filtered names. Here is the deal -
I have a table named CustEquipment, that has a field named CtagID and one
named CID. This table has lots of equipment listed, all differentiated by
the CID (company ID) I am trying to get the combo box to only give the
equipment that is owned by a particular CID. I have a main form, named
frmMain, with a tab control and several subforms, such as Customer Info,
Hardware, Software, etc.On the main form, I have a Customer Name combo box
that selects all the customer names. I have placed a CID field on all the
subforms for debugging purposes, and when I select a customer in the
Customer Name combo box, all the info in all the subforms is updated with
the correct info for that company via the CID field. On one of the subforms
on the tab control (actually I haven't tried this on the other ones yet -
this is the one I am working on right now) I have a combo box that I want to
populate with only the CtagIDs of the currently selected CID. The CID field
is being populated correctly with the CID of the currently selected company.
The rowsource entry for the CtagID is:
SELECT CustEquipment.CtagID FROM CustEquipment WHERE
CustEquipment.CID=Me.CID;
Every time I click the combo box, it prompts me for the CID! If I enter the
correct CID, the combo box is populated correctly, but it never again
prompts me for the CID even when I change Company Names. I have other fields
on other subforms that are date fields, and when I double click on them and
pop up a calendar, I am able to populate the date field with the contents of
the calendar control by using Me.LastDate or Me.DueDate.

I'm sure it is me, so where am I going wrong?
 
D

Digital Carnage

Hi Mike,
I'm not entirely sure what the answer is but I had a similar problem
last night myself. My issue is that the ID I need to enter was a data type
of text (check your table). Because if this, I had forgotten to encapsulate
the value with "" ' "" around the ID object. If your CtagID is numerical,
then this isn't the solution. Also, check your settings in the properties on
your bound columns, make sure that they're correct. Remember that the first
column begins with 0 (zero) and not 1. Does this help? Rich
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top