Hi running32,
pass the value of lngPatientId to new textbox in your Form,
then run the query, referening to this textbox
I hope this helps.
jaffer
Main Topics
Browse All TopicsI have a report which in an access adp project.
The query I am using is
SELECT tblMHCIntake.*, qselApplication.strPatient
qselApplication.strFName, qselApplication.strMName, qselApplication.strGenerat
qselApplication.ysnHomeCal
qselApplication.ysnHomeMsg
FROM qselApplication INNER JOIN
tblMHCIntake ON qselApplication.lngPatient
WHERE (tblMHCIntake.lngPatientId
When the button is clicked the macro to fire this report is
If frmMainsubBtm.SourceObject
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OutputTo acOutputReport, "rptMHCIntakeAll", acFormatSNP, strPath & lngPatientId & "-" & txtIntakeId & "-MHC_Intake.snp", True
I am getting the error One of yoru parameters is invalid. I know the parameter is tblMHCIntake.lngPatientId = ? but I'm not sure how to pass it the IngPatientId from the code to the query. If I run the query in the Statement Query window it brings back all the records.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
you said:
>Textbox 5 has the lngPatientId value
One way to test it is, Don't Run the code, but:
while the Form is open and Text5 has the value in it,
run the query:
In the query, in the lngPatientId field, place the following in the Criteria:
Forms![Your Form Name]![Text5]
This should give you the right Records.
jaffer
Could you just save the part that is causing the problem and bits of the Table, save them as mdb and send them.
The problem is that I cannot understand fully what is the problem.
OR
I can put together a sample mdb and send it to you, but you will have to tell me the structure of your adp and some data, so that I can mimic it and put it together.
I don't think the problem is in solving the problem, but I think it is in the communication/explaination
jaffer
Here is the code being called. This code will work if I want to call by txtIntakeId but I want to call by lngPatientId. thanks
Case Is = 16
If frmMainsubBtm.SourceObject
DoCmd.RunCommand acCmdSaveRecord
Set cnn = CurrentProject.Connection
Set r = New ADODB.Recordset
r.Open "tblMHCIntake", cnn, adOpenForwardOnly, adLockReadOnly
r.Filter = "lngPatientId=" & lngPatientId
If r.EOF = False Then
lngId = Forms!frmMain!txtIntakeId
Do Until r.EOF
Forms!frmMain!txtIntakeId = r.Fields("lngIntakeId")
DoCmd.OutputTo acOutputReport, "rptMHCIntakeAll", acFormatSNP, strPath & lngPatientId & "-" & txtIntakeId & "-MHC_Intake.snp", False
DoCmd.OpenReport "rptMHCIntakeAll", acViewNormal
r.MoveNext
Forms!frmMain!txtIntakeId = lngId
Loop
Else
MsgBox "Sorry, no client contacts to print.", vbInformation, "No Data..."
End If
r.Close
cnn.Close
Set r = Nothing
Set cnn = Nothing
End If
and here is the sql query
SELECT tblMHCIntake.*, qselApplication.strPatient
qselApplication.strFName, qselApplication.strMName, qselApplication.strGenerat
qselApplication.strOPhone,
qselApplication.strSSNum, qselApplication.bytEligibi
qselApplication.strCity, qselApplication.strState, qselApplication.strZip, qselApplication.strMAddres
qselApplication.strMCity, qselApplication.strMState,
qselApplication.intCat, qselApplication.intHouseho
qselApplication.ysnHomeCal
qselApplication.ysnHomeMsg
FROM qselApplication INNER JOIN
tblMHCIntake ON qselApplication.lngPatient
WHERE (qselApplication.lngPatien
Business Accounts
Answer for Membership
by: running32Posted on 2005-04-01 at 11:05:55ID: 13683419
If I hard code a value into WHERE (tblMHCIntake.lngPatientId = ?) then the report will run just fine.