SQL and Other Basic Stuff

J

Jonas

The portion of the project I am working on now is to create a table
based on criteria in another table. Below is the code that I have
produced so far. I am having trouble with naming the the new table
created via the make-table query. I would like the table to be named
abc1_abc2_abc3 where abc1 is equal to the variable in abc1, abc2 is
equal to the variable in abc2 and abc3 is equal to the variable in
abc3. In addition, I would like for access to automatically push enter
when prompted with the question: do you want to paste some number of
records into a new table after the make-table query has been run. I
have heard about sendkeys but I don't know how I could time it just
right so that the SendKeys command executed right after being promted
by access.

Suggestions are appreciated.

abc1 = myRecordSet.Fields(0).Value
abc2 = myRecordSet.Fields(1).Value
abc3 = myRecordSet.Fields(2).Value
MsgBox abc1
MsgBox abc2
MsgBox abc3

Dim StrSQL2 As String

MsgBox abc2

StrSQL2 = "SELECT NumericFile.Field1, NumericFile.Field2,
NumericFile.Field3, NumericFile.Field4, NumericFile.Field5 "
StrSQL2 = StrSQL2 + "INTO "
StrSQL2 = StrSQL2 + "'" & abc1 & "'"
StrSQL2 = StrSQL2 + "FROM NumericFile "
StrSQL2 = StrSQL2 + "WHERE (((NumericFile.Field2)='" & abc1_abc2_abc3 &
"') AND ((NumericFile.Field3)='" & abc2 & "') AND
((NumericFile.Field4)='" & abc3 & "'))"

DoCmd.RunSQL StrSQL2

End Sub
 
J

Jonas

I looked at some unrelated code an ran accross the setwarnings property
but I am still stumped on being able to create a new table based on the
values in variables.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top