I have combo boxes set up and work on all my forms. I am getting text data instead of the ID which is what i want. But when I create a query I get the ID and not the text that I want. What Am I doing wrong?
I have combo boxes set up and work on all my forms. I am getting text data instead of the ID which is what i want. But when I create a query I get the ID and not the text that I want. What Am I doing wrong?
Include the text field as well as the ID field in your query. A form or report doesn't need to include the id field, but it's often a good idea to include it but not show it. The user seldom needs to see the id data. If that doesn't help, maybe post the query sql, but we'll need to be able to relate that to the form fields.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
Let's assume you have a tables like
tblSomeTable: SomeTableID, Field1, Field2, LookupID;
tblLookupTable: LookupID, LookupValue
, and a form, which displays values from current record of tblSomeTable. The control linked to LookupID is a combo box with RowSource property like
, ControlSource property like LookupID, BoundColumn Propery as 1, and ColumnWidth like "0, 2.5". The value of combo box will be LookupID in tblSomeTable, but displayed is the matching value from tblLookupTable.Code:SELECT LookupID, LookupValue FROM tblLookupTable ORDR BY 2
Now you create a report to display data from tblSomeTable. The Source of report will be a query like
As it was commented before, there is no need for users to see any ID's, so you can set the Report control linked to SomeTableID as invisible, so for user the report displays values of Field1 and Field2 from tblSomeTable, and matching LookupValue values from tblLookupTable.Code:SELECT st.SomeTableID, st.Field1, st.Field2, lt.LookupValue FROM tblSomeTable st LEFT JOIN tblLookupTable lt ON lt.LookupID = st.LookupID ...
Sounds like you are using LookUp fields?What Am I doing wrong?
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
What kind of relational ones?
Are they limiting stepwise the selection of final one? I.e. there is a single lookup index in main table, and the last combo user can select is linked to it. All other combos are unbound ones. When this is case, you report source will be a query with single join (like in my example above);
Or are every one of them based on different lookup tables, and RowSource's of every combo are updated after every selection of every combo. When this is the case, the report source will be a query with multiple joins - a join for every lookup table involved. And displaying lookup values mathcing with apropriate lookup ID's.
No.
You are using a Lookup Field in the table for that particular field.?
That is the normal cause of not understanding, that you want to store the PK of a record, but see the descriptive text.
Like the picture.
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
...
Are you assuming, OP really speaks about table instead of from in opening post?
No, they are speaking about the form.
The first DB I created still has lookup fields in it, as shown in the picture.
However if I create a query on that table I will get the ID. However I understand how it is working.
The first pic is with Lookups. The second is without.
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
I agree with Welshgasman.
Can you upload a copy of the database?
You can PM me for help. Good Read https://docs.microsoft.com/en-gb/off...on-description
To attach file: https://www.accessforums.net/showthread.php?t=70301
So combobox displays text as it should?
Most likely confusion is caused by using LOOKUP field in table. Something most experienced developers never do.
Query will have to JOIN tables to retrieve text value from LOOKUP table.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Methinks it's time to see a db copy.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
Methinks, it is time to get some response from the O/P ?![]()
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
Sorry folks I didn't bail. I was on the road all day yesterday traveling. I will go through all post today after my appointments and see if I can get it solved.