Need Help With Requery

D

Dale

Need some help from the group; I am using Access 2000 on a Win2K system.
I have a continuous form with a data source of a query. By selecting
a button on the continuous form, I open a modal form that allows me to
edit a specific record from the continuous form. I can add/modify/or
delete an individual record. What I need to do is when I close the modal
form I need for the continuous form to requery to show the modifications .

I am using the isloaded function to ensure the continuous form is open.
What code do I use to requery the form?
 
P

PC Datasheet

You don't need the button first of all. Put the following code in the onclick
event of one of an appropriate field:

(pseudocode)

DoCmd.OpenForm "NameOfModalForm",,,"[PKFieldName] = " & Me!PKFieldName,,acDialog
If IsLoaded("NameOfModalForm") Then
Me.Requery
Me!SomeField.SetFocus 'If Needed
End If
 
D

Dale

I appreciate the quick response, however in that I am fairly new to
acces, I am not sure I understand your solution. The continuous form is
a list of all my records. When I click the button to open the modal
form to allow me to edit a specific record, what I need to do is when I
close that modal form is to requery the continuous form to show my
updates or deletions. It appears from the your pseudocode that it is
requerying the modal form and not the continuous form. Am I missing
something or just not explaining it clearly enough? Again Thanks for the
help.

PC said:
You don't need the button first of all. Put the following code in the onclick
event of one of an appropriate field:

(pseudocode)

DoCmd.OpenForm "NameOfModalForm",,,"[PKFieldName] = " & Me!PKFieldName,,acDialog
If IsLoaded("NameOfModalForm") Then
Me.Requery
Me!SomeField.SetFocus 'If Needed
End If


--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
www.pcdatasheet.com


Need some help from the group; I am using Access 2000 on a Win2K system.
I have a continuous form with a data source of a query. By selecting
a button on the continuous form, I open a modal form that allows me to
edit a specific record from the continuous form. I can add/modify/or
delete an individual record. What I need to do is when I close the modal
form I need for the continuous form to requery to show the modifications .

I am using the isloaded function to ensure the continuous form is open.
What code do I use to requery the form?
 
P

PC Datasheet

Dale,

The code is in your continuous form so the line Me.Requery requeries the
continuous form after you edit and SAVE the record in the modal form.

Steve
PC Datasheet

Dale said:
I appreciate the quick response, however in that I am fairly new to
acces, I am not sure I understand your solution. The continuous form is
a list of all my records. When I click the button to open the modal
form to allow me to edit a specific record, what I need to do is when I
close that modal form is to requery the continuous form to show my
updates or deletions. It appears from the your pseudocode that it is
requerying the modal form and not the continuous form. Am I missing
something or just not explaining it clearly enough? Again Thanks for the
help.

PC said:
You don't need the button first of all. Put the following code in the onclick
event of one of an appropriate field:

(pseudocode)

DoCmd.OpenForm "NameOfModalForm",,,"[PKFieldName] = " & Me!PKFieldName,,acDialog
If IsLoaded("NameOfModalForm") Then
Me.Requery
Me!SomeField.SetFocus 'If Needed
End If


--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
www.pcdatasheet.com


Need some help from the group; I am using Access 2000 on a Win2K system.
I have a continuous form with a data source of a query. By selecting
a button on the continuous form, I open a modal form that allows me to
edit a specific record from the continuous form. I can add/modify/or
delete an individual record. What I need to do is when I close the modal
form I need for the continuous form to requery to show the modifications .

I am using the isloaded function to ensure the continuous form is open.
What code do I use to requery the form?
 
V

Van T. Dinh

Steve

I would take the "If" out altogether and simply have:

Me.Requery
Me.SomeControl.SetFocus

The statements inside the If construct as posted will never get executed as
the other Form is open modal hence the execution pauses and will only resume
when the modal Form is closed. In this case the IsLoaded is False and the
Requery statement is skipped.
 

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