Refresh Problem, Help!

Chris-eh

Registered User.
Local time
Today, 10:39
Joined
Aug 14, 2002
Messages
30
Hello,

I've done a search on refreshing forms but am not sure if/how I can relate any of the solutions to my problem.

Summary: I have a main form called Accessibilty Survey Form which then through a button links to a second form called External form which has built in subforms. The Main form is for main data entry which the user would fill out and then move onto the second form to continue data entry on the current record. However, when they finish entering in data on the main form and go into the second form, there are fields on the External form which should display main form data which was just entered doesn't carry over/link to the current record. I have to close both forms and re-enter to refresh. Forms remain one form one to the next , one does not close when going into the next.

Q: Is there a way to refresh the link to the main form, like creating a button on the second form, or some other way? I have tried creating a requery button on the External form but doesn't work properly.
I'm really new when it comes to code, so please explain simply and with LOTS of detailing (Also, I'm using Access 97 if makes diff)

Thanks, (in advance)
Chris-eh
 
I think this is similar to a problem I had....the reply is somewhere on this forum under richio.

The code is entered to look for all open forms and refresh...it worked fine for me.

I will try and find the exact code if I can and get back to you
 
Re:Help

Great! I'll see if I can find it also, and let you know...I'll wait for further word...

Thanks
 
This Code?

I think I found it, it was suggested to you by Harry...
Are you talking this code?

dim frm as Form
For Each frm In Forms
If frm.Name = "MainFormName" then
Forms!MainFormName.Refresh
End if
Next frm

Does it go on the main form or the second form or a button on which one?I'm guessing main form...?
 
Code Not working

I tried that code on the main form under After update as:
Event procedure: (...)button, then

Dim frm As Form
For Each frm In Forms
If frm.Name = "Accessibility Survey Form" Then
Forms![Accessibility Survey Form].Refresh
End If
Next frm

does not like the spaces in the main form name , also didn't update or refresh the new record in the secodn form External Form. Am I doing this wrong???
 
Didn't work

that won't work cuz my second form has the form back ground with tab control pages with @5 subforms on these pages , I would have to put this button function on all subforms, wouldn't I. I tried it with my button on the External form (second form with tabbed subforms) and put that expression under my button on the External form- on click - event procedure -
changed it to Me.Parent![mainform].Requery
and got runtime error- 2452
the expression has an invalid refer to the Parent Property.
maybe I did that wrong ???
 
I have my code on the "On Close" section of the form which when you close you want the main form refreshed..ie not the main form

HTH
 
On close sol'n

So did I find the right code then?

none of my forms close from one to the next...one just opens over top of the other

but i'll try it...
 
Just before you open the second form, you need to save the current record.

DoCmd.RunCommand acCmdSaveRecord
 
Command

Where would I put this command?

does it go on the main form? what property?
 
Pat Hartman Wins!

Thank-you thank-you!

I took your command and put it into an event procedure for a button on my main form under the On click property. It works! A user can enter data on the main form then click the button to save the new record before moving to the next form, and it does link/update the data/record onto the next form.

Thanks a bunch,
Chris-eh
 

Users who are viewing this thread

Back
Top Bottom