search?

Alright folks - he is back with his final task.

this is a simple one, yet i cannot seem to do it no matter how many google searches i do.

Code:
Dim empCount As Integer
Dim sqlresults As String

'count tables
empCount = DCount("*", "Employees_search")

'display tables
If empCount > 0 Then
MsgBox "yes"
sqlresults = "INSERT INTO search_results("
sqlresults = sqlresults & "'Table'" & ","
sqlresults = sqlresults & " 'number_of_records'" & ") VALUES ("
sqlresults = sqlresults & "'Employees'" & ","
sqlresults = sqlresults & " empCount" & ")"

Debug.Print sqlresults

DoCmd.RunSQL sqlresults

End If
End Sub

Debug.print is:
INSERT INTO search_results('Table', 'number_of_records') VALUES ('Employees', empCount)


i am simply trying to put the name of the table along with the count of records into the search results table. the records get counted properly but when i run the code it prompts me to enter a parameter value for empCount. this is simply a test example, once this works i will implement it for the rest of the necessary tables.

this is the last one i promise :)
 
You don't want the single quotes around the names of the fields in the destination table, only around the value for a text field. And again, you'll need to concatenate the empCount variable in.
 
SUCCESS!!:D

it is complete.

and once again thank you all for your help.
you have saved me alot of headache and time on this.
 

Users who are viewing this thread

Back
Top Bottom