sandyarela
New member
- Local time
- Today, 09:01
- Joined
- May 24, 2012
- Messages
- 5
Hi,
I have a question on string concatenation.
Some code background info: In the form frmMainMenu, there is a text box that gets the computer name 'txtUserID'. I'm trying to create unique table names according to individual that runs the code. qryMaker is just a query.
Here's the code:
Dim tblName As String
Dim strSQL As String
tblName = "tblQueryMaker" & [Forms]![frmMainMenu]![txtUserID]
strSQL = "SELECT * INTO " & tblName & " FROM qryMaker;"
DoCmd.RunSQL (strSQL)
I've tried DoCmd.RunSQL and .execute, but both get the same error message of " must have at least one destination field." It seems that " FROM qryMaker;" does not get concatenated to strSQL, and I can't figure out why.
Thanks!
I have a question on string concatenation.
Some code background info: In the form frmMainMenu, there is a text box that gets the computer name 'txtUserID'. I'm trying to create unique table names according to individual that runs the code. qryMaker is just a query.
Here's the code:
Dim tblName As String
Dim strSQL As String
tblName = "tblQueryMaker" & [Forms]![frmMainMenu]![txtUserID]
strSQL = "SELECT * INTO " & tblName & " FROM qryMaker;"
DoCmd.RunSQL (strSQL)
I've tried DoCmd.RunSQL and .execute, but both get the same error message of " must have at least one destination field." It seems that " FROM qryMaker;" does not get concatenated to strSQL, and I can't figure out why.
Thanks!