Select Statement

Mechele

Registered User.
Local time
Today, 10:52
Joined
Jan 25, 2002
Messages
121
What is wrong with the statement below?
After the event occurs, the me.employerTemp displays the code instead of a value.


Private Sub PatientName_AfterUpdate()
Dim strSQL As String

strSQL = "SELECT data.GroupID FROM Data WHERE me.ssn = data.ssn;"
Me.EmployerTemp = strSQL

End Sub
 
You are assigning the string contained within strSQL to the control Me.EmployerTemp. At no point have you given a command to execute an sql statment. Try using DLookup; it's very similar to the SQL statement you're using.

HTH
Ed
 
You can't assign a query to a textbox. You can bind a field from the query; just never the actual SQL. A textbox can only display one field of one record. A SELECT statement may return 1000s of records. Each record can't fit into the one textbox.
 

Users who are viewing this thread

Back
Top Bottom