Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Run time error 3079 "The specified field could rever to more than one table listed in the FROM clause of your SQL statement

Posted on 2004-10-30
1
Medium Priority
?
586 Views
Last Modified: 2008-01-16
Using VBA and writing my own SQL statements, I have three tables to extract data from.  

Key values are:
  tblPatientInformation.PatientID
  tblPulmonary.EvaluationID
  tblFunctionalImpairmentsMonitor.EvaluationID

I have done the appropriate relationships using the Relationships tool

The code.
'******************************************************************************
 'Construct SQL statement
Dim strSQL
strSQL = " SELECT PD.*, PI.PatientID, PI.LastName, FIM.O2_Sat_RA" + _
             " FROM tblPulmonaryDisease PD, tblPatientInformation PI, tblFunctionalImpairmentsMonitor FIM" + _
             " WHERE (PD.PatientID = PI.PatientID) And (PD.EvaluationID = FIM.EvaluationID) And " + _
              (PD.PatientID = " 
strSQL = strSQL + "'" + Me.textboxPatientID.Value + "'" + ") "
strSQL = strSQL + " ORDER BY PD.EvaluationID;"
'******************************************************************************

I get back the 3079 run time error.  Please help.

Thanks,
Jim Botts
jsbotts713@leaco.net
 
0
Comment
Question by:jbotts
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 18

Accepted Solution

by:
Data-Man earned 500 total points
ID: 12454074
Try this if PatientID is a number

Dim strSQL
strSQL = "SELECT PD.*, PI.PatientID, PI.LastName, FIM.O2_Sat_RA" & _
             " FROM tblPulmonaryDisease PD, tblPatientInformation PI, tblFunctionalImpairmentsMonitor FIM" & _
             " WHERE (PD.PatientID = PI.PatientID) And (PD.EvaluationID = FIM.EvaluationID) And " & _
             " (PD.PatientID = " & Me.textboxPatientID.Value & ") ORDER BY PD.EvaluationID;"


if PatientID is a string do this

strSQL = "SELECT PD.*, PI.PatientID, PI.LastName, FIM.O2_Sat_RA" & _
             " FROM tblPulmonaryDisease PD, tblPatientInformation PI, tblFunctionalImpairmentsMonitor FIM" & _
             " WHERE (PD.PatientID = PI.PatientID) And (PD.EvaluationID = FIM.EvaluationID) And " & _
             " (PD.PatientID = '" & Me.textboxPatientID.Value & "') ORDER BY PD.EvaluationID;"

Mike
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question