Share via

When converting to 64 bit .accdb. Compile code. Method or member not found.

Anonymous
2024-12-27T14:54:56+00:00

I updated our Access database (.mdb, 32 bit) to .accdb (64 bit). When I did this, the scripts in the database gave this error: Compile code. Method or member not found. A previous colleague wrote these scripts and I am less familiar with the coding.

The code for one of the scripts is below and I have attached an image of it too to show the areas that are highlighted when I receive the error. It must be something to do with the upgrade to 64-bit.

Private Sub Find_Seal_Brand()

Dim rstseals As Recordset

Dim dbs As Database

Set dbs = CurrentDb

Set rstseals = dbs.OpenRecordset("seals", dbOpenDynaset)

Dim Strname As String

On Error GoTo ErrorAction

Strname = InputBox("Enter Brand To Locate")

If Strname <> "" Then

'rstseals.FindFirst "BrandID like '*" & Strname & "*'"

rstseals.FindFirst "BrandID = '" & Strname & "'"

Screen.PreviousControl.SetFocus

DoCmd.GoToControl "BrandID"

If rstseals.NoMatch Then

  MsgBox ("No Such Brand")

Else

  DoCmd.FindRecord Strname, acAnywhere

End If

rstseals.Close

End If

ExitAction:

Exit Sub

ErrorAction:

MsgBox Err.Description

Resume ExitAction

End Sub

Microsoft 365 and Office | Access | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

4 answers

Sort by: Most helpful
  1. Anonymous
    2024-12-28T00:50:23+00:00

    Calling the InputBox function is a rather imprecise means of navigating to a record.  Opening a dialogue form in which there is an unbound combo box control which lists all BrandID values sorted alphabetically would mean that a user can only select a brand currently represented in the database.  Moreover, if the user types a value into the control, rather than scrolling down through the list, the control will progressively go to the first match as each character is entered.

    For examples of the use of unbound combo boxes (or multi-select list boxes where appropriate) to find records in a variety of contexts, you might like to take a look at FindRecord.zip in my public databases folder at:

    https://1drv.ms/f/c/44cc60d7fea42912/EhIppP7XYMwggESpAAAAAAAB3aLXYo7DdARg01KnQIyoLg?e=fASl3m

    Was this answer helpful?

    0 comments No comments
  2. George Hepworth 22,855 Reputation points Volunteer Moderator
    2024-12-27T19:44:06+00:00

    In addition to the article Scott provided as a link, you can find a lot of useful information about modifying 32 bit Access databases for 64 bit Access in Videos like these.

    https://youtu.be/NE-ixCSkEgI?si=PYSSRMapEj_FNa0F

    https://youtu.be/uaIWrBguynQ?si=4bNgP0onzh0RoefF

    https://youtu.be/B4U9CBgqE_U?si=EAJzbTkr4HyLWnPP

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2024-12-27T17:26:56+00:00

    If Strname <> "" Then

    'rstseals.FindFirst "BrandID like '*" & Strname & "*'"

    rstseals.FindFirst "BrandID = '" & Strname & "'"

    H DLidgard,

    You could replace typical HTML-style < > & by respective VBA-style <, > and &.

    Imb.

    Was this answer helpful?

    0 comments No comments
  4. ScottGem 68,830 Reputation points Volunteer Moderator
    2024-12-27T16:24:47+00:00

    Did you update all your DECLARE statements as per this article: The code in this project must be updated for use on 64-bit systems | Microsoft Learn?

    If you didn't that could be the cause.

    However, there was no attachment or screen shot to show which line threw the error. Without knowing which line of code errored out we really can't help.

    What I suggest you do (if you haven't) is search for every DECLARE statement and update them for 64 bit. then Run a Debug>Compile to see if there are any other lines of code that have a problem. If there are, post the offending code so we can help further.

    Edit: I didn't spot what Imb spotted. Did you just copy and paste the code? Does the code appear in the VBE with the HTML style concatenations Or the VBA style ones. Definitely, switch to VBA style if they do.

    Was this answer helpful?

    0 comments No comments