Reputation: 219
I have the query
SELECT [Forms]![frmDataEntry]![Combo3];
I also have a form called frmDataEntry with a combo box called combo3 on it. The combo box has multiple values, and one is selected when I run the query. I used the macro expression builder to open the query when a button is pressed.
Similar/the same sql was working last night, from the same combo box. I have tried doing the some thing with different forms and controls, yet nothing returns a result. I also tried making a new query and putting in the sql again.
Upvotes: 1
Views: 1294
Reputation: 97101
My cboUserID
on Form2
has the 47 selected for its bound value.
This query returns an empty field:
SELECT Forms!Form2!cboUserID;
Explicitly telling the db engine I want the combo's .Value
property gives me a single slash character (/
) as this query's result:
SELECT Forms!Form2!cboUserID.Value
Yet this query tells me "Long" as the data type of the combo's bound value, which is correct:
SELECT TypeName(Forms!Form2!cboUserID.Value)
So I tried the CLng()
function to inform the db engine I want the combo's value as a Long Integer, and this query gave me 47 ... which is the selected value in the combo:
SELECT CLng(Forms!Form2!cboUserID.Value);
I have no idea why this is so; I've never tried this before. I'll just suggest you try the appropriate data type conversion function for your combo. [CLng
; CInt
; CDbl
; CStr
; CDate
; etc] Also I used Access 2007 for my tests because I don't have 2010. I hope 2010 behaves similarly for you.
Upvotes: 1