Access How to Query SQL Server from an Access field

PVC

Joined
Jun 8, 2005
Messages
1
Reaction score
0
This is probably so obvious that I'll feel embarassed by the answer - sorry.

Building a user interface in Access 2000 connected to SQL Svr 2000. I'm attempting to set an Event Procedure for On Enter a particular Text Box. When I constructed it Access opened the VB environment and I've set the element as below.

Private Sub OperatorName_Enter()
Dim SQL As String

SQL = "SELECT MasterOperatorDetail.MasterOperatorName" & _
"FROM MasterOperatorDetail,CollectedData" & _
"WHERE CollectedData.ClockNumber = MasterOperatorDetail.MasterOperatorClockNo" & _
"AND CollectedData.OperatorPIN = MasterOperatorDetail.MasterOperatorPIN"

' RunSQL SQL 'This is the problem area - unsure of syntax/command

SQL = OperatorName.Value

End Sub

The above tables called in the query were constructed when I set up the Project using new data. The above Select Query functions properly in SQL Server's Query Analyzer and returns expected results.

Where I need help is getting the syntax/command right.

Thoughts and/or direction(s) most appreciated. I've Googled this to no avail so the search entry I'm using must be backwards as well.

Thanks - PC
 
Back
Top