Share via

Problem With Button On Access 2019 Form

Anonymous
2021-12-09T18:43:30+00:00

I create a form.

I add a

I add a button.

I right click on button and select Properties

I click on the dropdown next to On Click and select [Event Procedure]

   Click on the three dots and a Sub is created with the name of the button

I add code to the sub

Save the form

Open the form

Click on the button

Get an error message:

How do I fix this?

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

7 answers

Sort by: Most helpful
  1. Anonymous
    2021-12-14T02:43:59+00:00

    Tom -

    Was my reply deleted for a specific reason?

    Was this answer helpful?

    0 comments No comments
  2. Tom van Stiphout 40,211 Reputation points MVP Volunteer Moderator
    2021-12-11T15:14:28+00:00

    Your code works fine for me. Copy it to a new database. Not the same problem, right?

    So there is something about the current db that you haven't told us. Does the code compile? Do you have missing references?

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2021-12-11T12:20:31+00:00

    Have you tried performing an Office Repair?

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2021-12-09T22:09:13+00:00

    Private Sub Command0_Click()

    Dim nLocation As Integer 
    
    Dim i As Integer 
    
    Dim strNameOfItem As String 
    
    Dim strValueOfItem As String 
    
    Dim vVariant(200, 3) As Variant 
    
    i = 1 
    
    Do Until Environ(i) = "" 
    
        vVariant(i, 3) = Environ(i) 
    
        nLocation = i 
    
        strNameOfItem = Left(vVariant(i, 3), InStr(1, vVariant(i, 3), "=", vbTextCompare) - 1) 
    
        strValueOfItem = Right(vVariant(i, 3), Len(vVariant(i, 3)) - InStr(1, vVariant(i, 3), "=")) 
    
        Debug.Print strNameOfItem 
    
        Debug.Print strValueOfItem 
    
        Debug.Print i, vVariant(i, 3) 
    
        i = i + 1 
    
    Loop 
    

    End Sub

    Was this answer helpful?

    0 comments No comments
  5. George Hepworth 22,855 Reputation points Volunteer Moderator
    2021-12-09T21:06:28+00:00

    Unfortunately, there's not enough information in your post to attempt a suggestion.

    Show us (Copy and paste, not screenshot, please) what is in that sub. That's where the information needed should be.

    Was this answer helpful?

    0 comments No comments