Requery

Haytham

Registered User.
Local time
Today, 23:40
Joined
Jun 27, 2001
Messages
162
Hi All...
I have a main form which contains UnBound Field called ProductId and some controls for the quantity available linked to queries. When ProductId entered, I have a button which opens another form (Dialog) to add New Products for the specific Products. After close the Dialog form, how can I refresh my controls to add the new products to the available quantity....
If I close the form and open it again, it calculates the right amount.
The point is not to close and open again.
I tried OnActivate EventProcedure... Me.ControlName.Requery , but it did't help me.
Any other suggestions please
Thank you in advance
:mad: :confused: :mad: :( :mad: :eek: :confused:
 
Perhaps try Me.Refresh on OnActivate.
 
Sorry, Me.Refresh is not available now... I got this message:confused:
 
Sorry - not sure why none of those is working. Perhaps someone else can help ...?
 
It depends on how your product quantities are calculated. You say that you have
some controls for the quantity available linked to queries
. I'm assuming that you have the recordsource for the form as a query. If the product quantity is calculated in the query, then you will have to requery the whole form, not just the control. If however, you are using an aggregate function you will need to refresh the form, but as you have already tried this, I suspect that this is not the case.

Unfortunately, when you requery a form, the recordset 'resets' itself to the first record.

Try this in the On_Activate event
Code:
Dim varBookmark as variant
varBookmark=Me.Bookmark
me.requery
me.bookmark = varBookmark
 
Hi Ally, thank you for your help.
Hi Fizzio,
Actually, my UnBound Control is picking a data by DLookUp ... from a query.
When I put the code:
Dim varBookmark As Variant
varBookmark = Me.bookmark
Me.Requery
Me.bookmark = varBookmark

it gives me:
tou entered an expression that has an invalid reference to the property Bookmark.

Any idea:confused: :confused: :confused:
 

Users who are viewing this thread

Back
Top Bottom