Full Version: Using Insert Into To Update 2 Fields
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
swaziman1
Hi,

I want to insert into tblConditions the following.
txtUserID in table field USERID and strNewData in table field Conditions.

I'm having a bit of trouble with my SQL.

I am trying the following:
strSQL = "INSERT INTO tblCondition (UserID,Conditions) VALUES ([forms]![frmfeeschedule]![txtUserID], '" & NewData & "')"

but this isn't giving me the desired results.

Can anyone point me in the right direction.

Thanks.
Peter46
What your code nearly does is add a new record into tblconditions.

If that is what you intend then you need..
strSQL = "INSERT INTO tblCondition (UserID,Conditions) VALUES (" & [forms]![frmfeeschedule]![txtUserID] & ", '" & strNewData & "')"

This assumes that Userid is a number.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.