Curious error message on opening a report.

F

Frank Martin

I want to open a report RptCustPricelist to display the specific customer
showing on the FrmPriceList.
I am using the following code:

***

Private Sub Command48_Click()

On Error GoTo Err_Command48_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "RptCustPricelist"

stLinkCriteria = "[AddressesID]=" & "'" & Me![AddressesID] & "'"
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
DoCmd.RunCommand acCmdZoom75
Exit_Command48_Click:
Exit Sub

Err_Command48_Click:
MsgBox Err.Description
Resume Exit_Command48_Click

End Sub

***
(AddressesID is an autonumber)

The error message is:

"Runtime error 3464
Datatype mismatch in criteria expression".

I just can't see where this is. Can someone help?
Frank
 
D

Duane Hookom

You are coding as if AddressesID is text. Try
stLinkCriteria = "[AddressesID]=" & Me![AddressesID]
 
F

Frank Martin

Many thanks. This fixed it fine.
Regards Frank



Duane Hookom said:
You are coding as if AddressesID is text. Try
stLinkCriteria = "[AddressesID]=" & Me![AddressesID]

--
Duane Hookom
MS Access MVP
--

Frank Martin said:
I want to open a report RptCustPricelist to display the specific customer
showing on the FrmPriceList.
I am using the following code:

***

Private Sub Command48_Click()

On Error GoTo Err_Command48_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "RptCustPricelist"

stLinkCriteria = "[AddressesID]=" & "'" & Me![AddressesID] & "'"
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
DoCmd.RunCommand acCmdZoom75
Exit_Command48_Click:
Exit Sub

Err_Command48_Click:
MsgBox Err.Description
Resume Exit_Command48_Click

End Sub

***
(AddressesID is an autonumber)

The error message is:

"Runtime error 3464
Datatype mismatch in criteria expression".

I just can't see where this is. Can someone help?
Frank
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top