• SQL Friendly (V2000 SR1)

    Author
    Topic
    #375879

    I’m helping a friend convert an Access back-end database into a SQL Server back-end. We are testing some of the Access commands on the front-end and are fixing errors as we find them. One bit of coding I can’t seem to figure out is this bit:

    ‘ This code uses the After Update event of a drop-down named: cboLName to find a specific customer
    Me.cboLName.Requery
    ‘ The following code looks for the last name in the field CustomerLName and goes to that record.
    Me.RecordsetClone.FindFirst “[CustomerLName] ” & Me.cboLName
    Me.Bookmark = Me.RecordsetClone.Bookmark

    It functions perfectly in Access but pulls up incorrect names using SQL and an ODBC connection. Does anyone know the proper coding or why it doesn’t function with a SQL back-end?
    Thanks!!

    Viewing 1 reply thread
    Author
    Replies
    • #614604

      Just a thought. Try using the complete name for [CustomerLName]. Include the table name. i.e.

      [tblMyTableName]![CustomerLName] Substitute your table name for tblMyTableName.

      • #615419

        Thanks Tom,
        For some reason, this bit of code just didn’t want to work. I ended up using FindRecord instead and that has worked without a snag.
        Thanks for the idea and have a great week!

    • #614613

      You had:
      ??Me.RecordsetClone.FindFirst “[CustomerLName] ” & Me.cboLName<

      Try this instead:
      Me.RecordsetClone.FindFirst "[CustomerLName] =" & chr(34) & Me.cboLName chr(34)

      • #615420

        Mark,
        Thanks for the help. I used SetFocus to go to the proper control and then ended up using FindRecord to properly find what I needed. For some reason the other code was inconsistent (even with the change you suggested).
        Thanks for the idea and have a great week!

    Viewing 1 reply thread
    Reply To: Reply #614604 in SQL Friendly (V2000 SR1)

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

    Your information:




    Cancel