Report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to preview a report based in two primary keys. I can do it with one
primary key, but I don't know how to do it with two. Here is what I'm doing
with just one primary key which is "SocialSN". I need to preview the report
with "LoanId" key, so if one person has more than one loan, I can see only
the one I have on screen. Can somebody help me?

DoCmd.OpenReport "RptLoan2", acPreview, , "[SocialSN] =
Forms![Loan].form![SocialSN]"
 
I need to preview a report based in two primary keys. I can do it with one
primary key, but I don't know how to do it with two. Here is what I'm doing
with just one primary key which is "SocialSN". I need to preview the report
with "LoanId" key, so if one person has more than one loan, I can see only
the one I have on screen. Can somebody help me?

DoCmd.OpenReport "RptLoan2", acPreview, , "[SocialSN] =
Forms![Loan].form![SocialSN]"

I'm sure your [SocialSN] field is text datatype ( it shoule be), and I
assume that your [LoadID] field id Number datatype.

DoCmd.OpenReport "RptLoan2", acPreview, , "[SocialSN] = '" &
Forms![Loan].form![SocialSN] & "' and [LoanID] = " & [LoanID]
 
Fred,

It doesn't work, any other suggestions.

Gloria

fredg said:
I need to preview a report based in two primary keys. I can do it with one
primary key, but I don't know how to do it with two. Here is what I'm doing
with just one primary key which is "SocialSN". I need to preview the report
with "LoanId" key, so if one person has more than one loan, I can see only
the one I have on screen. Can somebody help me?

DoCmd.OpenReport "RptLoan2", acPreview, , "[SocialSN] =
Forms![Loan].form![SocialSN]"

I'm sure your [SocialSN] field is text datatype ( it shoule be), and I
assume that your [LoadID] field id Number datatype.

DoCmd.OpenReport "RptLoan2", acPreview, , "[SocialSN] = '" &
Forms![Loan].form![SocialSN] & "' and [LoanID] = " & [LoanID]
 
You should tell Fred (and others) what you mean by "doesn't work". What are
your symptoms? Was Fred correct in his assumptions in the previous reply?

If you really want assistance, please try to be a bit more descriptive and
reply to the assumptions made by someone attempted to assist you.

--
Duane Hookom
MS Access MVP


Gloria said:
Fred,

It doesn't work, any other suggestions.

Gloria

fredg said:
I need to preview a report based in two primary keys. I can do it with
one
primary key, but I don't know how to do it with two. Here is what I'm
doing
with just one primary key which is "SocialSN". I need to preview the
report
with "LoanId" key, so if one person has more than one loan, I can see
only
the one I have on screen. Can somebody help me?

DoCmd.OpenReport "RptLoan2", acPreview, , "[SocialSN] =
Forms![Loan].form![SocialSN]"

I'm sure your [SocialSN] field is text datatype ( it shoule be), and I
assume that your [LoadID] field id Number datatype.

DoCmd.OpenReport "RptLoan2", acPreview, , "[SocialSN] = '" &
Forms![Loan].form![SocialSN] & "' and [LoanID] = " & [LoanID]
 
Duane, thanks for your suggestion.
Fred,
Here is the error message I receive when I used: DoCmd.OpenReport
"RptLoan2", acPreview, , "[SocialSN] = '" &
Forms![Loan].form![SocialSN] & "' and [LoanID] = " & [LoanID]

Error Message:

Syntax error (missing operator) in query expression
'([SocialSN]="and[LoanID]38)'

Any other suggestions.
 
It looks like you aren't getting a value from Forms![Loan].form![SocialSN].
Your syntax should be:
Forms![FormName]![ControlName]
This would change if the control was on a subform.
 
Thanks for all your help. I got it.

Duane Hookom said:
It looks like you aren't getting a value from Forms![Loan].form![SocialSN].
Your syntax should be:
Forms![FormName]![ControlName]
This would change if the control was on a subform.

--
Duane Hookom
MS Access MVP


Gloria said:
Duane, thanks for your suggestion.
Fred,
Here is the error message I receive when I used: DoCmd.OpenReport
"RptLoan2", acPreview, , "[SocialSN] = '" &
Forms![Loan].form![SocialSN] & "' and [LoanID] = " & [LoanID]

Error Message:

Syntax error (missing operator) in query expression
'([SocialSN]="and[LoanID]38)'

Any other suggestions.
 
Back
Top