Requery in Access 2000

S

Sheila D

I need to update a combo box and have the following code working perfectly in
Access 2007
Private Sub Manufacturer_AfterUpdate()
DoCmd.Requery "Manufacturer"
End Sub

In Access 2000 it comes up with error message
Run time error 2488
You can't use the Apply Filter action on this window
I need this to run on Access 2000 - do I need to express it differently

Thanks
 
S

Sheila D

Thank you Christopher, I have an odd success with this whereby if I add a new
value in a record the combo box does not refresh immediately, it only
refreshes when I add a second record

ie if I add Fred to the list the next record does not show Fred in the
dropdown but if I add another record (with the same or different value) then
the drop down refreshes to show Fred. Any ideas? Also do you know if this
code will still work if the database is later updated to 2007 or has the VB
changed?
Sheila
 
C

Christopher Robin

Hi Sheila,

I think that means the data isn't being requeried, which is kind of odd.
Here is the code I have from a database I put together. The code originally
comes from a previous version of Access, but works in 2007 as well.

Private Sub Store_NotInList(NewData As String, Response As Integer)
MsgBox "Double-click this field to add an entry to the list."
Response = acDataErrContinue
End Sub
Private Sub Store_DblClick(Cancel As Integer)
On Error GoTo Err_Store_DblClick
Dim lngStore As String

If IsNull(Me![Store]) Then
Me![Store].Text = ""
Else
lngStore = Me![Store]
Me![Store] = Null
End If
DoCmd.OpenForm "Stores", , , , , acDialog, "GotoNew"
Me![Store].Requery
If lngStore <> Null Then Me![Store] = lngStore

Exit_Store_DblClick:
Exit Sub

Err_Store_DblClick:
MsgBox Err.Description
Resume Exit_Store_DblClick
End Sub
 
S

Sheila D

Thanks Christopher, that looks far too clever for me!!
I'll play around with it but may repost the question and see if anyone else
know why it's not requerying immediately. Thanks for your help so far

Sheila

Christopher Robin said:
Hi Sheila,

I think that means the data isn't being requeried, which is kind of odd.
Here is the code I have from a database I put together. The code originally
comes from a previous version of Access, but works in 2007 as well.

Private Sub Store_NotInList(NewData As String, Response As Integer)
MsgBox "Double-click this field to add an entry to the list."
Response = acDataErrContinue
End Sub
Private Sub Store_DblClick(Cancel As Integer)
On Error GoTo Err_Store_DblClick
Dim lngStore As String

If IsNull(Me![Store]) Then
Me![Store].Text = ""
Else
lngStore = Me![Store]
Me![Store] = Null
End If
DoCmd.OpenForm "Stores", , , , , acDialog, "GotoNew"
Me![Store].Requery
If lngStore <> Null Then Me![Store] = lngStore

Exit_Store_DblClick:
Exit Sub

Err_Store_DblClick:
MsgBox Err.Description
Resume Exit_Store_DblClick
End Sub

Sheila D said:
Thank you Christopher, I have an odd success with this whereby if I add a new
value in a record the combo box does not refresh immediately, it only
refreshes when I add a second record

ie if I add Fred to the list the next record does not show Fred in the
dropdown but if I add another record (with the same or different value) then
the drop down refreshes to show Fred. Any ideas? Also do you know if this
code will still work if the database is later updated to 2007 or has the VB
changed?
Sheila
 

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