LinkCriteria in OpenReport
I have just asked the Forum how can i convert a string value into a number value and i received an excellent solution. (Thank you, Francois !!!)
Now my new code works fine.Through a control called FindIt i am finding the CustomerID in the form Customers by typing its CompanyName and then the whole information about this Customer appears on my Form called Customers.I want now to go one step futher and open a report only for the Custoemr i have just typed its CustomerName.I cannot open the report, i receive the message syntax error missing operator
the code i use is the following :
Private Sub Findit_AfterUpdate()
‘Use the bookmark to move to a the selected customer
‘From “Microsoft Access 2000 Development Unleashed” (SAMS)
‘By: Forte, Howe, Ralston
Dim rsclone As DAO.Recordset
Dim recordID As Variant
Dim IDValue As Long
Set rsclone = Me.RecordsetClone
IDValue = CStr(Me![Findit])
recordID = “CustomerID = ” & IDValue
rsclone.FindFirst recordID
bm = rsclone.Bookmark
Me.Bookmark = bm
‘up to here the code is fine, the typed in Customer is populated on the form Customers.
But then after pressing Enter to open the report, i receve the message syntax error.:
Dim stLinkCriteria As String
Dim stDocName As String
stLinkCriteria = “CustomerID ” & IDValue
stDocName = “SalesSummary”
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
End Sub
Can somebody help me where my mistake lies ?