Results 1 to 5 of 5
  1. #1
    RSMonroe is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2019
    Posts
    1

    Angry disappearing Errors

    I wrote a simple Database to keep track of pieced of Art I have made. When the form opens or moves to another record I have two pieces of code which run.

    Private Sub CmbSEARCH_Change()


    Dim SearchValue As String
    Dim rst As DAO.Recordset
    SearchValue = Me!CmbSEARCH


    Set rst = Me.Recordset.Clone
    rst.FindFirst ("[ItemName] = '" & SearchValue & "'")
    If Not rst.EOF Then Me.Bookmark = rst.Bookmark

    Me!CmbSEARCH = ""

    End Sub


    Private Sub Form_Current()




    If Me!SOLD = True Then
    lblSOLD.Visible = True
    Else
    lblSOLD.Visible = False
    End If

    End Sub

    The following error statement occurs, "The Expression On Change you entered as the event property setting produced the following error: Object or class does not support the set of events." This repeats if I attempt to change to a different record.

    If I then view the form in design, go to the On Current on the property sheet, click on the three dots and open the Visual Basic window, DO NOTHING TO IT, go back to the form window, change to the form view and move to a different record thereby run the code THAT I HAVE NOT CHANGED. Everything is fine. No problem, can keep on doing everything I need to do, until the next time I start up Access and open the form. Then I have to do that all over again cause it gives me the same error.

    WTF

    Anyone have any thoughts?

  2. #2
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    WTF
    That had better be Wednesday, Thursday, Friday or else you might find your posts are lacking in repsponses.
    Perhaps state what you want rather than what doesn't work because some of what I see makes no sense.
    First, the On Change event does not fire when a form opens:
    When the form opens or moves to another record I have two pieces of code which run.
    It fires every time you press a key when the control that has code for that event has the focus. This means you're creating a recordset and executing the code with every keystroke.

    As far as things seeming to work when flipping between design and form view, that usually means that some part of the code will not result in a setting that is being attempted. The fact that it seems to perform otherwise means that the setting is not crucial to the function being performed. Ignoring errors because something seems to work is risky.
    EDIT
    Forgot to ask you to post code within code tags (# on forum toolbar).
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    perhaps make use of vba intellisense rather than type what you like and expect vba to understand

    Set rst = Me.Recordset.Clone

    if you put option explicit at the top of the module (should be at the top of all modules) and compile your code you would find basic errors such as this.

    you will also find using the bang as here Me!CmbSEARCH does not use intellisense and will not pick up the sort of basic error.




  4. #4
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    Ajax, good catch. I pretty much just glossed over the code because of the opening statements, plus I seem to have an issue with code that's not tagged. Will have to pay more attention.

  5. #5
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    plus I seem to have an issue with code that's not tagged.
    so do I. OP's been advised so let it go this one time

    And I agree with your other comment...

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Disappearing Form
    By hinchi1 in forum Access
    Replies: 4
    Last Post: 06-12-2018, 05:54 AM
  2. Disappearing New Records
    By JaimeFrye in forum Access
    Replies: 2
    Last Post: 11-22-2016, 12:20 PM
  3. Replies: 4
    Last Post: 06-21-2014, 05:43 AM
  4. Disappearing Act
    By CementCarver in forum Forms
    Replies: 4
    Last Post: 09-04-2013, 03:08 PM
  5. Replies: 10
    Last Post: 07-25-2011, 12:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums