Requery question

  • Thread starter Thread starter Mike Painter
  • Start date Start date
M

Mike Painter

In a subform I have the following code in the after update event for a
"hookuplookup" combobox which binds to HookupID. The box shows the sold
field.

If Not IsNull(Me!hookUP) Then
Me!sold = True
Me!Hookuplookup.Requery
End If

The idea is that the user is presented with only those camp site hookups
that are not sold.

It works but is always one sale "behind"
If I sell hookup 1 and move to the next record it will show hookup 1, 2,
3,... in the combo with 1 marked sold. I sell 2 and on the next line it
shows only 2 and 3 with 2 marked sold.

The order is not important, it just requires two sales to get rid of the
first sold item. DoEvents does not fix the problem.
 
You need to save the changes to the record before you requery.

Me!Sold = True
Me.Dirty = False 'to save the changes to the record
Me!Hookuplookup.Requery
 
In a subform I have the following code in the after update event for a
"hookuplookup" combobox which binds to HookupID. The box shows the sold
field.

If Not IsNull(Me!hookUP) Then
Me!sold = True
Me!Hookuplookup.Requery
End If

The idea is that the user is presented with only those camp site hookups
that are not sold.

It works but is always one sale "behind"
If I sell hookup 1 and move to the next record it will show hookup 1, 2,
3,... in the combo with 1 marked sold. I sell 2 and on the next line it
shows only 2 and 3 with 2 marked sold.
save the record, bevor you requery with me.refresh
 
Wayne said:
You need to save the changes to the record before you requery.

Me!Sold = True
Me.Dirty = False 'to save the changes to the record
Me!Hookuplookup.Requery
Thanks.
 
Back
Top