Hello,
I have a form with multiple combo box whose values are based on a different tables. My rotation table is made up of two fields: Rotation ID and Rotation. There is currently only two records in there: Standard and Reverse, each with an auto generated ID number.
SELECT DISTINCTROW [RotationTbl].[RotationID], [RotationTbl].[Rotation] FROM [RotationTbl]
I also have another table, Product which contains rotation as one of the fields. It also has a product ID, product name, and a few other fields (size and material) in there. I currently have a query which links the ProductTbl with the Rotation Tbl. In the form, there is combo boxes for ProductName, Rotation, Size and Material.
That works fine, but when I add an "ALL" option I get the following error:
"The number of columns in the two selected tables or queries of a union query don't match."
I then went back and tried basing the combo box on the entire table (ID field and Rotation field):
SELECT DISTINCTROW [RotationTbl].[RotationID], [RotationTbl].[Rotation] FROM [RotationTbl] UNION SELECT "*" as RotationID, "(All)" as Rotation from RotationTbl.
However, when I select the All option and try to run the query, I get an error saying that there's a "Datatype mismatch in criteria expression."
I think the issue is that the ID field is an AutoNumber, while the Rotation field is Text therefore there's two different types of data. However, when I base my table only on the Rotation field, it tells me the Union query won't work because of the different number of columns...
Can someone please tell me what I need to do to try to fix this problem? I've tried researching it online, but nothing I've found has seemed to fix it. I'm new to access and VBA so any explanation behind any sql/ vba code would be appreciated. Thanks in advance!