I have a form that adds a record when the user clicks a button. It does some edit checks and then the insert statement is
CurrentDb.Execute "Insert into [Trip Details] (
[ListID],[Price],[Departure Date],[Group],[Cruise Line], [Category], [Ship],Destination,[Cabin No], Insurance)" & _
"Values (" & Me!
[ListID] & ",'" & Me![Price] & "',#" & Me![depdate] & "#," & Me![grp] & "," & Me![cline] & ", " & Me![cat] & ", " & Me![Ship] & ",'" & Me![dest] & "','" & Me![cabno] & "'," & intins & ")"
The fields Group, Cruise Line, Category, and Ship are combo boxes on the form. These are defined in the table that I'm inserting into as "Long Integer" storing the key of another table. The insert works fine if I select something from each combo box and get a value, but if I leave any of them blank it gives me an "Insert Error" message.
I'm assuming I need to change the properties on these fields somehow to allow them to be left blank. I have tried setting the default value to Null and 0 but get the same message.
Thanks for any insight.
CurrentDb.Execute "Insert into [Trip Details] (
[ListID],[Price],[Departure Date],[Group],[Cruise Line], [Category], [Ship],Destination,[Cabin No], Insurance)" & _
"Values (" & Me!
[ListID] & ",'" & Me![Price] & "',#" & Me![depdate] & "#," & Me![grp] & "," & Me![cline] & ", " & Me![cat] & ", " & Me![Ship] & ",'" & Me![dest] & "','" & Me![cabno] & "'," & intins & ")"
The fields Group, Cruise Line, Category, and Ship are combo boxes on the form. These are defined in the table that I'm inserting into as "Long Integer" storing the key of another table. The insert works fine if I select something from each combo box and get a value, but if I leave any of them blank it gives me an "Insert Error" message.
I'm assuming I need to change the properties on these fields somehow to allow them to be left blank. I have tried setting the default value to Null and 0 but get the same message.
Thanks for any insight.
