list box not refreshing

R

Robert

I have the same issue with the following :

I'm trying to update an Access list box after the table
it is linked to has changed with the following VB code
attached to a command button :

Private Sub cmdAdd_location_Click()

Set dbsDB1 = OpenDatabase("c:\DB1.mdb")
Set rstLocation = _
dbsDB1.OpenRecordset("tblLocation", dbOpenTable)

rstLocation.AddNew
txtLocation.SetFocus
rstLocation.Location_name = txtLocation.Text
rstLocation.Update
rstLocation.Close

lstLocation_name.Requery
End Sub

The first time I click the command button the table
updates but not the list box. If I click the command
button a second time the list box updates and shows both
new records from the table. After this the update seems to
work ok i.e. the problem seems to be the first update only.

- any ideas ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top