Forum Discussion

RichNewman's avatar
RichNewman
Copper Contributor
Mar 23, 2021

List Box anomaly

I have a multi-user Access application -- each user has a client piece locally, all looking at a single Access database with the table data on a company network.

A form on that client application (let's call it Form1) has a number of objects, including a list box and several buttons.  The form itself is unbound.  One button has some code for the OnClick event, and all the VBA code behind the click event does is simply open open another form (call it, Form2).  But, when I click that button on Form1 to open Form2 (which is also an unbound form), I can see that the list box on Form1 requeries (or refreshes -- I can't tell).  There is nothing in the VBA code to requery the listbox on Form1.

Has anyone ever encountered such an anomaly or have any thoughts on what might be causing this anomaly?

12 Replies

  • George_Hepworth's avatar
    George_Hepworth
    Silver Contributor

    RichNewman 

     

    I wonder if you've found the place where the requery is being triggered. If you'd like, I could take a look. Can you provide a sample copy of the accdb with any personal or confidential data removed?

  • George_Hepworth's avatar
    George_Hepworth
    Silver Contributor

    RichNewman 

    Unfortunately, without SEEING the actual code, it's impossible to guess what might be happening.

    To share the code, you can open the form in design view and select the VBA for the button's click event. Copy it all and paste it here. That way someone might be able to spot a line that could be causing this.

     

     

    • RichNewman's avatar
      RichNewman
      Copper Contributor

      George_Hepworth 

       

      Thanks for the prompt reply.  Here is the code, but it's really amazingly simple..

       

      Private Sub Command6_Click()
           Dim stDocName As String
           Dim stLinkCriteria As String

           stDocName = "frmContractAdd"
           DoCmd.OpenForm stDocName, , , stLinkCriteria
      End Sub

       

      • George_Hepworth's avatar
        George_Hepworth
        Silver Contributor

        RichNewman 

        Also, what happens in that second form, "frmContractAdd"? Is it adding a new contract to the table which is also the row source for this list box, by any chance?

Resources