Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

listbox selected(0) causing error Error 3020

Discussion in 'Information Technology' started by default105, Jul 28, 2006.

  1. default105

    Expand Collapse

    I have a reminder form that has a listbox (ListUnrecOnEmployee) that displays
    3 columns that is populated by sql. Each row contain values that coinside
    with some of the fields on the current record. The onclick for this
    listbox(ListUnrecOnEmployee) has a findrecord command so the user can quickly
    move between the queried records. I have another listbox(ListOrderedItems)
    for the items ordered that populates based on the current ID of the form.
    The onCurrent event of the form will requery that control to update it. All
    of this works as expected. I then thought it would be nice for the users if
    listbox1 would be highlight on the current record based on the current
    record. I thought it was working fine until I closed it and reopened it,
    then I got this error when I click on either of the listboxs - Update or
    CancelUpdate without AddNew or Edit. (Error 3020). So I opted out the line
    of code and the error goes away. I have included the code to help. I have
    searched the web for help and have not found anything that has helped. I
    believe it is probably something that I have wrong and would greatly
    appreciate any input you may have.

    Code on the first listbox(ListUnrecOnEmployee)
    Private Sub ListUnrecOnEmployee_Click()

    Dim intGoToPORec As Integer
    intGoToPORec = Me.ListUnrecOnEmployee.Column(0)
    DoCmd.FindRecord intGoToPORec, , , , , , True
    End Sub

    Code for the Form onCurrent
    Private Sub Form_Current()

    Dim lngPOCRec As Long
    lngPOCRec = (Me.CurrentRecord) - 1

    'Me.ListUnrecOnEmployee.Selected(lngPOCRec) = True 'opted out error 3020

    End Sub
  2. default105

    Expand Collapse

    I found that if I used this, I could achieve the desired result. Would still
    appreciate your input on this.

    Private Sub Form_Current()
    Dim lngPOCRec As Long
    lngPOCRec = (Me.CurrentRecord) - 1

    Me.ListUnrecOnEmployee.ListIndex = lngPOCRec

    End Sub
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     

Share This Page