update cascading forms

O

OD

Hi

This has probably been asked a number of times but I couldn't find a
resolution for my issue. I have a form that calls a second form. Form 1
displays the client information (name, address, phone) in view only. The 2nd
form allows the client to change the information. The information updates
correctly to the database but I can't get the orginal form to show the
updated information without closing out and going back in. I know I need to
requery or do a find = but can't figure out which event this should go in.
There's no real code I can post as I don't know what or where to do this. Any
help is appreciated
Thanks
 
D

Douglas J. Steele

How are you opening Form 2?

If you're opening it as a dialog form from Form 1, that means execution of
code in Form 1 halts until Form 2 is closed, so you can simply put the
requery as the next line of code.

If you're not opening it as a dialog form, try putting the Requery into the
GotFocus event of Form 1, or have Form 2 requery Form 1 as it's closing.
 
R

RonaldoOneNil

In the On Close event of your 2nd form put this code using your own form 1's
name.

Forms![Form 1 Name].Refresh
 
O

OD

Thank you but that didn't work. This is what I've been up against for a while
for some reason. This should've worked but...

RonaldoOneNil said:
In the On Close event of your 2nd form put this code using your own form 1's
name.

Forms![Form 1 Name].Refresh

OD said:
Hi

This has probably been asked a number of times but I couldn't find a
resolution for my issue. I have a form that calls a second form. Form 1
displays the client information (name, address, phone) in view only. The 2nd
form allows the client to change the information. The information updates
correctly to the database but I can't get the orginal form to show the
updated information without closing out and going back in. I know I need to
requery or do a find = but can't figure out which event this should go in.
There's no real code I can post as I don't know what or where to do this. Any
help is appreciated
Thanks
 
R

RonaldoOneNil

Forms![Form 1 Name].Requery should work

OD said:
Thank you but that didn't work. This is what I've been up against for a while
for some reason. This should've worked but...

RonaldoOneNil said:
In the On Close event of your 2nd form put this code using your own form 1's
name.

Forms![Form 1 Name].Refresh

OD said:
Hi

This has probably been asked a number of times but I couldn't find a
resolution for my issue. I have a form that calls a second form. Form 1
displays the client information (name, address, phone) in view only. The 2nd
form allows the client to change the information. The information updates
correctly to the database but I can't get the orginal form to show the
updated information without closing out and going back in. I know I need to
requery or do a find = but can't figure out which event this should go in.
There's no real code I can post as I don't know what or where to do this. Any
help is appreciated
Thanks
 
O

OD

Thanks Doug
But in my case here, this didn't work. Not sure what I'm doing wrong here.
When I run a trace it calls the open form but if I have a breakpoint after
the openform on the refresh - it skips over all the calls in the 2nd form
after it opens which doesn't make sense
 
O

OD

I agree - it should but it didn't. Not sure what's going on here right now.
been stuck on this for quite a while now

RonaldoOneNil said:
Forms![Form 1 Name].Requery should work

OD said:
Thank you but that didn't work. This is what I've been up against for a while
for some reason. This should've worked but...

RonaldoOneNil said:
In the On Close event of your 2nd form put this code using your own form 1's
name.

Forms![Form 1 Name].Refresh

:

Hi

This has probably been asked a number of times but I couldn't find a
resolution for my issue. I have a form that calls a second form. Form 1
displays the client information (name, address, phone) in view only. The 2nd
form allows the client to change the information. The information updates
correctly to the database but I can't get the orginal form to show the
updated information without closing out and going back in. I know I need to
requery or do a find = but can't figure out which event this should go in.
There's no real code I can post as I don't know what or where to do this. Any
help is appreciated
Thanks
 
O

OD

Thanks Doug,

Yeah, it's confusing and I think I brought it on myself. Just can't figure
out how to dig myself out. I put a breakpoint in after the call to open the
next form and the program went to the next line in the current form and
didn't open the next form. The next form is an unbound which I do an update
query to modify the record but since I'm technically not closing or leaving
the prior form there's no "activate", "Focus" or anything like that. I'm
playing with closing the forms as I call the next one and then reopening but
this is giving me issues doing that too.
Like I said, probably brounght on by how I imagined doing this.

Thanks
 
O

OD

Really not much to show.
Private Sub cmdEditEmp_Click()
On Error GoTo HandleError


DoCmd.OpenForm "frmEditEmployeeLicInfo"


After some of the conversations here, I had a Me.Requery or Me.Refresh after
the above line. When I tried tracing through the program it would make the
call but it wouldn't "leave" the form. It went on to the next line
(refresh,requery) and stopped on the line after docmd.OpenForm instead of
passing control over to the next form which is why it seems like the refresh,
requery, repaint that has been suggested isn't working as it actually never
gives up control

BruceM via AccessMonster.com said:
It would help to see the code you are using. Please describe where the break
point is placed, and what happens (or doesn't) as you step through the code.
Thanks Doug,

Yeah, it's confusing and I think I brought it on myself. Just can't figure
out how to dig myself out. I put a breakpoint in after the call to open the
next form and the program went to the next line in the current form and
didn't open the next form. The next form is an unbound which I do an update
query to modify the record but since I'm technically not closing or leaving
the prior form there's no "activate", "Focus" or anything like that. I'm
playing with closing the forms as I call the next one and then reopening but
this is giving me issues doing that too.
Like I said, probably brounght on by how I imagined doing this.

Thanks
Not sure I understand what you're saying.
[quoted text clipped - 39 lines]

--
Message posted via AccessMonster.com


.
 
O

OD

Excellent. Thank you all for the tips. I put the code in the on activate
event and it works for the most part. i just have one more refresh to take
care

Thanks again

BruceM via AccessMonster.com said:
I will use frmMain as the name of the form in which the command button code
exists. I don't think I have tried requerying the current form after the
line of code that opens another form, but I suspect part of the problem at
least is that the "attention" goes back to frmMain when you requery or
refresh it. Is the code you posted all of the code? If so, what did you
mean in the previous posting by "the program went to the next line in the
current form and didn't open the next form"? If not, what other code is in
the cmdEditEmp Click event? Did frmEditEmployeeLicInfo open, but end up
behind frmMain?

If you want a form to stay on top until it is closed or hidden, open it in
dialog mode:

DoCmd.OpenForm "frmEditEmployeeLicInfo",WindowMode:=acDialog

Also, if frmMain is opened in dialog mode I think you will need to hide or
close it before opening another form.

Really not much to show.
Private Sub cmdEditEmp_Click()
On Error GoTo HandleError


DoCmd.OpenForm "frmEditEmployeeLicInfo"


After some of the conversations here, I had a Me.Requery or Me.Refresh after
the above line. When I tried tracing through the program it would make the
call but it wouldn't "leave" the form. It went on to the next line
(refresh,requery) and stopped on the line after docmd.OpenForm instead of
passing control over to the next form which is why it seems like the refresh,
requery, repaint that has been suggested isn't working as it actually never
gives up control
It would help to see the code you are using. Please describe where the break
point is placed, and what happens (or doesn't) as you step through the code.
[quoted text clipped - 18 lines]
 

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