var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Unbound form...
this should be easy....
I have an unbound form...I want an On Click event to open a table, create a new record and write several fields from the form to the table. Any help would be appreciated....
You are going to want to use some SQL to accomplish this. Look at the INSERT command through your help.
Originally Posted by
INSERT INTO table (fields, fields) VALUES (values, values)
Thanks for the help but I'm having some real problems with the formatting....
I have 2 Strings (strA and strB) that I want to enter into Fld1 & Fld2 in TblA...Can you help?
Also, does anyone know if this can be accomplished using ADO??(I'm curious....)
Something along this line between your Subs.
Dim SQL as string
SQL = "UPDATE Table SET Table.FieldA = forms!yourform!StrA, Sql & Table.[FieldB] = forms!yourform!StrB"
Helpfull I hope.
I think that you will have to take Darsens suggestion a little further because the SQL statement will be looking for a string and when useing the value of a control directly in the statement it is just like using a string variable. so the SQL statement will have to go something like this
SQL = "UPDATE Table SET Table.FieldA = '" & forms!yourform!StrA & "', " Table.[FieldB] = '" & forms!yourform!StrB & "'"
that way you are concatenating the variables into the SQL statement which is a string and when revering to a string value within that statement you use a single quote ' instead of a double quote "
I hope that helps
although its no bad thing to fully qualify your variable names you can be more idle and use
SQL = "UPDATE Table SET Table.FieldA = '" & StrA & "', " Table.[FieldB] = '" & StrB & "' ;"
to avoid the problems of enclosing strings varaibles in SQL if often resort to
SQL = "UPDATE Table SET Table.FieldA = " & chr$(34) & StrA & chr$(34) & ", "& chr$(34) & Table.[FieldB] = '" & StrB & chr$(34) &" ;"
its also advisable to end your sql with a semi colon, sometimes JET understands, sometimes it gets snotty, so I'd reccomend that you always end SQL statements with a semi colon.
thanks for the advise guys....i figured it out with ADO...but I think its time I learn how to insert sql into VBA....