var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Append query.
I have a form with a textbox (txtAddName).
I would like to append the value of this txtInput to a table (TblName) with the following structure:
Could someone help me out with the code for this? Can this be done with an Append query?
Why don't you bound the Form to the table?
From form to append query
The form is a transaction form that links to multiple tables. Hence I cannot bind it to a table.
My issue was with Append query. I could not build an Append query without a table in QBE (as the input was coming from a form). I found the way out. For the benefit of those who see, here it is...
The SQL query, I typed in was:
INSERT INTO TblName (Name, Address) VALUES (txtAddName, txtAddress).
Access turned this into:
INSERT INTO TblName ( Name, Address ) SELECT txtAddName AS A, txtAddress AS B;
It works well in QBE. Codewise it works with:
docmd.runSQL "INSERT INTO blah blah;"
However it doesn't work with:
currentdb.execute "INSERT INTO the same blah blah;"
This gives an error:
"Too few parameters. Expected 2".
I prefer currentdb.execute as it avoids all the warnings.
Any help is appreciated.
Re: From form to append query
I had the same problem. And I use DoCmd. You can avoid the warnings by means of DoCmd.setWarnings False before the runSQL
After that you can activate the warnings with DoCmd.setWarnings True