• LinkCriteria in Openreport (Access 2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » LinkCriteria in Openreport (Access 2000)

    Author
    Topic
    #363933

    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 ?

    Viewing 0 reply threads
    Author
    Replies
    • #557010

      In the top few lines you define IDValue as long and then set it equal to CStr(…). Is this where one problem lies?
      Further down in the construction of the stLinkCriteria you have
      stLinkCriteria=”CustomerID” & IDValue.
      It should be
      stLinkCriteria=”CustomerID=” & IDValue

    Viewing 0 reply threads
    Reply To: LinkCriteria in Openreport (Access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: