Urgent Help Needed - Migrated to access 2007 and now my db's are broke!?!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • scolivas
    New Member
    • Oct 2006
    • 56

    #1

    Urgent Help Needed - Migrated to access 2007 and now my db's are broke!?!

    Help! I just upgraded from 0ffice 2003 to Office 2007 and when I opened one of my DB's its broke!

    Seems

    <code>
    ' Find the record that matches the control.
    Dim rs As Object

    Set rs = Me.Recordset.Cl one
    rs.FindFirst "[Carton#] = " & Str(Nz(Me![List2], 0))
    If Not rs.EOF Then Me.Bookmark = rs.Bookmark

    </code>
    is no longer allowed?

    I keep getting this error:

    Compile error:
    Can't Find project or library


    Can some one help me fix the code so when I type into the txt box it finds the record with matchin info?

    I don't know what the "Str(Nz" part is from - one of you guys helped me set this up over a year ago.

    Im in a rush - this is my eBay Tracking Database - and am in real bad shape without it.

    Thanks!

    Sophie
  • Megalog
    Recognized Expert Contributor
    • Sep 2007
    • 378

    #2
    Try:

    Code:
    ' Find the record that matches the control.
    Dim rs As DAO.Recordset
    
    Set rs = Me.RecordsetClone
    rs.FindFirst "[Carton#] = " & Str(Nz(Me![List2], 0))
    
    if rs.NoMatch then
          MsgBox "Record not Found"
    else
         Me.Bookmark = rs.Bookmark
    end if
    
    rs.Close
    I'm not sure why you're using the Str function, that puts a leading space in front of the returned number. Might want to just switch it out with a Cstr instead, but that's just guessing based on what you've given here for code & table/field structures.

    Comment

    • scolivas
      New Member
      • Oct 2006
      • 56

      #3
      Originally posted by Megalog
      Try:

      Code:
      ' Find the record that matches the control.
      Dim rs As DAO.Recordset
      
      Set rs = Me.RecordsetClone
      rs.FindFirst "[Carton#] = " & Str(Nz(Me![List2], 0))
      
      if rs.NoMatch then
            MsgBox "Record not Found"
      else
           Me.Bookmark = rs.Bookmark
      end if
      
      rs.Close
      I'm not sure why you're using the Str function, that puts a leading space in front of the returned number. Might want to just switch it out with a Cstr instead, but that's just guessing based on what you've given here for code & table/field structures.

      I am not sure why there is a Str function either -

      What I am doing is I have a form that opens that allows me to input data to a table based on the Carton# entered.

      So when I open the form - there is a list box that is highlighted and waiting for entry or I can select from the list box - but I type faster than I scroll...so i would rather type it in. The list box "select" feature still works fine, but the typing part does not - for somereason it is not matching what i type to the list.

      When I type a "Carton#" into the box - it pulls that record and allows me to edit the record.

      There is no query behind this - just an open form w/input.

      used to be a me. function and was pretty simple

      I don't know where the str came from or the NZ either - I think that is something that the new access put in to try and fix the code when it opened it up.

      Unfortunately I did not print the code before I upgraded - not realizing that the vba in access 2003 and access 2007 were not going to be seamlessly compatible.

      Anyway if you have any idea how to do this your help would be greatly appreciated. I will try to get use the wizard and recreate the form...maybe I can get it to work that way.

      Thanks!
      Sophie

      Comment

      • Stewart Ross
        Recognized Expert Moderator Specialist
        • Feb 2008
        • 2545

        #4
        Hi. Have you checked under Tools, References from the VB editor that you still have a reference to the DAO object library? Looking at your code I am sure what you are using remains just as valid now as it was when it was written.

        -Stewart

        Comment

        • dbpros
          New Member
          • Mar 2008
          • 15

          #5
          I agree with Stewart, sounds like your references might be lost.
          Open a module and go to tools, references and ensure your DAO and ADO libraries are checked off.

          Comment

          Working...