Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mulitple text boxes to different table from form

Status
Not open for further replies.

cubicle

Technical User
Oct 1, 2013
1
US
I am using the following code to insert a value from a bound form to a different table:

Code:
CurrentDb.Execute "Insert into tblfavorites (employeeNumber) Values('" & Me.Employee_Number & "')"

Can someone help me with adding to this if I wanted to add to 2 different fields in a table from 2 different text boxes?

I cant seem to figure it out.

Thank you
 
[tt]CurrentDb.Execute "Insert into tblfavorites (employeeNumber, OtherField) Values('" & Me.Employee_Number & "', " & OtherTextBox & ")"
[/tt]

But that all depends if you have a string (add single quotes around it), a number (no quotes) or a Data (add # around the date.)

But I would suggest doing it this way:

Code:
Dim strSQL as String

strSQL = "Insert into tblfavorites (employeeNumber, OtherField) Values('" & Me.Employee_Number & "', " & OtherTextBox & ")" 

CurrentDb.Execute strSQL

Have fun.

---- Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top