Solved How do I compare date variable in combo box?

hucheunghugo

New member
Local time
Today, 09:24
Joined
Apr 11, 2022
Messages
23
DoCmd.RunSQL "Update Houses SET Houses.DateCond = 1 WHERE (DateValue(Houses.Date) = #Combo347.value# );"
This is my code
But they keep showing me that there are runtime error 3075
I am getting frustrated by that
 
Last edited:
Either of two ways:
Code:
DoCmd.RunSQL "Update Houses SET Houses.DateCond = 1 WHERE (DateValue(Houses.Date) =  Forms![" & Me.Name & "]!Combo347 );"

or

Code:
DoCmd.RunSQL "Update Houses SET Houses.DateCond = 1 WHERE (DateValue(Houses.Date) =  #" & Me.Combo347 & "# );"

It would depend on whether the bound column from the combo was a real date variable or a date string.
 
Sorry to disturb
I tried the second one, it shows that type mismatch, does it mean that i have to use the first one?
And do i have to change the Me.Name for the first way
Thanks!

Either of two ways:
Code:
DoCmd.RunSQL "Update Houses SET Houses.DateCond = 1 WHERE (DateValue(Houses.Date) =  Forms![" & Me.Name & "]!Combo347 );"

or

Code:
DoCmd.RunSQL "Update Houses SET Houses.DateCond = 1 WHERE (DateValue(Houses.Date) =  #" & Me.Combo347 & "# );"

It would depend on whether the bound column from the combo was a real date variable or a date string.
 
Either of two ways:
Code:
DoCmd.RunSQL "Update Houses SET Houses.DateCond = 1 WHERE (DateValue(Houses.Date) =  Forms![" & Me.Name & "]!Combo347 );"

or

Code:
DoCmd.RunSQL "Update Houses SET Houses.DateCond = 1 WHERE (DateValue(Houses.Date) =  #" & Me.Combo347 & "# );"

It would depend on whether the bound column from the combo was a real date variable or a date string.
Oh wait Its fixed thanks a lot
 

Users who are viewing this thread

Back
Top Bottom