Question:
I have the below code in a MAKE TABLE QUERY?
Hansford C
2007-01-24 13:38:17 UTC
StrSQL = "SELECT TeamTblStartUp.Team INTO """ & "VarTeamCk &"" FROM TeamTblStartUp;"

I need this code to change depending on the info in the variable VarTeamCk
Dim VarTeamCk as String
Dim SC as String
SC = "41"
VarTeamCk = "tblTempA"&[SC]

Code above should create a table = tblTempA41 .......

I am getting an error with my code can someone help please need asap......last problem with lengthly db GETTING GRAY HAIR OVER IT....

Any help at all would be appreciate...
Dwight
Three answers:
Special Ed
2007-01-24 14:06:59 UTC
You are pretty darn close :



Dim VarTeamCk as String

Dim SC as String

SC = "41"

VarTeamCk = "[tblTempA" & SC & "]" '***Changes here



StrSQL = "SELECT [TeamTblStartUp].Team INTO " & VarTeamCk &" FROM TeamTblStartUp"



Debug.Print StrSQL



--Should be : SELECT [TeamTblStartUp].Team INTO [tblTempA41] FROM TeamTblStartUp



Brackets are not really necessary, just for clarity. Hope that helps!
bumbass2003
2007-01-24 21:46:33 UTC
Although this wont answer your question, I believe you will need to make people aware of what database engine you are connecting to and what language you are using (if not SQL). That looks more like VBScript or VBA than SQL to me, but I dont know SQL very well. I know different databse engines interpret the SQL standards differently.
aaron
2007-01-24 21:57:06 UTC
(((Q: I have the below code in a MAKE TABLE QUERY?)))

A: You should first CREATE the table and then make a QUERY.



((((Code above should create a table = tblTempA41 .......)))

How can you make a QUERY when the table doesn't even exist!!


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...