That's good to know. I figured with the craziness that I needed to accomplish for security reasons the strSQL would work for the multiple instances of it's use depending on the scenario.
But I did learn that this whole time I thought I needed the INNER JOIN for this to work they way I needed...
HOLY Explicit!!!
Ok.. I FINALLY got it figured out and didn't even need INNER JOIN. :D
Here is the code that worked
strSQL = "Select * INTO " & TableName & " FROM [Letter Information] WHERE ([Letter Information].ID)=" & Forms![Search Form]![SID] & ";"
And on a side tid-bit I tried for...
Using this code I was able to get a "Make Table" query to do what I was trying...
SELECT * INTO zzpzdc
FROM [Letter Information]
WHERE ((([Letter Information].ID)=[Forms]![Search Form]![SID]));
Still need to get this to happen using "strSQL" as that creates the table name based on the users...
When I pasted that code into a query and ran it it came back with the 1 record that matched ID 107892.
And if I do it as
SELECT * FROM [Letter Information] INNER JOIN [Letter Search - Query] ON [Letter Information].ID = [Letter Search - Query].ID WHERE ((([Letter...
It looks like with or without the "INTO" statement it is grabbing the data I need; just erroring out and not creating the table and putting the data into that table.
Only other thing I can think of is this is also the only SQL statement I am using that is looking at a table and a query to match...
Update: I copy and pasted the code you showed me and still getting error 3061 Too Few parameters. Expected 9.
ElseIf Screen.ActiveControl.Name = "Print" Then strSQL = "SELECT * INTO " & TableName & " FROM [Letter Information] INNER JOIN [Letter Search - Query] ON [Letter...
Funny thing is all the other SQL statements are working perfectly. Just this dern Inner Join one that isn't. I added the space with the WHERE statement and it actually made no difference to the error.
Does the fact that I am writing this in a Module as a Function have any bearing on the code...
Sorry wasn't trying to bury you. I did try removing the " " before from the ID; then no ID value was being returned in the immediate window. I will re-write with what you are asking and let you know the results.
Arrrghh.. This is driving me bonkers. :( Still getting parameter error. Here is the full code that I'm using. I'm not sure if this will help. Also having it look at a form for the value shouldn't be causing any problems correct? I tried removing the "INTO" code and get the same results...