Trying to code INSERT INTO Table

cstickman

Registered User.
Local time
Today, 08:46
Joined
Nov 10, 2014
Messages
109
Hey guys,

I have a form that is calling data from a table. Then the user can determine if they approve the question or not. So what I am trying to do is take one combo box that has yes or no and write it to the database. I thought I had it correct, but appears I do not as it is not writing yes or no to the table. The field initially has no value and that is my query for calling the data for the user to select from. Here is the code that I have so far

<code>
'add approval to yes
CurrentDb.Execute "INSERT INTO travelerQA(approval)" & _
" VALUES('" & Me.cmbapproveda & "')"
</code>

Any help or suggestions would be greatly appreciated. Thanks
 
Is approval a text field in your table?
Isnt it docmd.runsql you need?
Why don't you link your field directly to the corresponding field of the table (under properties, data)
 
Yes the approval field is a text field. Thanks
 
...as it is not writing yes or no to the table.
...
Try to determine what value you are inserting in the field, use Debug.Print then look in the Immediate window.
You can also paste what you get in the Immediate window into a new query, then it is easier to see what is wrong.

Code:
Debug.Print "INSERT INTO travelerQA(approval)" & _
    " VALUES('" & Me.cmbapproveda & "')"
 
Create it in the query builder and copy the sql text
 
I found my mistake - I was using an insert into command when I was actually just updating a record. I also ended up just making a query instead and that fixed the issue. Thanks for the suggestions!!
 

Users who are viewing this thread

Back
Top Bottom