Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

print current record based on two ID's 1

Status
Not open for further replies.

Pampers

Technical User
Apr 7, 2004
1,300
AN
Hi everyone,
I want to print the current record (from my form) where the strWhere consists of two ID's, ConsigneeID and VoyageID. Not sure how to do this, I tried the below code (combining the two ID's into one), but that sometimes produces a double record ;-) for obvious reasons. Any Tips?


Code:
Dim strReportName As String
    Dim strWhere1, strWhere2, strWhere3 As Integer
    Dim ConsVoyID As String

    strReportName = "rprtDemurrageInvoice"
    
    strWhere1 = "[ConsVoyID]=" & Me![ConsVoyID]
    DoCmd.OpenReport strReportName, acViewPreview, , strWhere1

Pampers [afro]
There is only one way to change a diaper - fast
 
I'm a bit confused with your issue.
You wanted this ?
DoCmd.OpenReport "rprtDemurrageInvoice", acViewPreview, , "ConsigneeID=" & Me!ConsigneeID & " AND VoyageID=" & Me!VoyageID

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Yes, that is the one... Perfect! Couldn't get it right. I also tried to do it with three strWhere's, but could't get that to work either. It seems the conconnotation for this:

strWhere1 = "ConsigneeID=" & Me!ConsigneeID & " AND VoyageID=" & Me!VoyageID

is this ===>

strWhere1 = "ConsigneeID =" & Me.ConsigneeID
strWhere2 = "VoyageID=" & Me.VoyageID
strWhere3 = strWhere1 & " And strWhere2"

The conconnotations always drive me nuts, I think I can't even spell the word right.
Anyway, tnx a lot.




Pampers [afro]
There is only one way to change a diaper - fast
 
what I put above is wrong.

must be:

is this ====>

strWhere1 = "ConsigneeID=" & Me!ConsigneeID
strWhere2 = "and VoyageID=" & Me!VoyageID
strWhere3 = strWhere1 & strWhere2


Pampers [afro]
There is only one way to change a diaper - fast
 
Actually, I think you're going to have to add a space in front of that "and", i.e.
Code:
strWhere2 = " and VoyageID=" & Me!VoyageID
 
tnx JoeAtWOrk, you right.

Pampers [afro]
There is only one way to change a diaper - fast
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top