Full Version: Multiple Actions when Button is Pressed
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
dbrune
I have a problem that if fixed will simplify my DB file a lot. I have a form called "CreditFaciility" and when the LastName field on a subform called "subGuarantors" is double clicked I need to open the form "PersonGuarantor". This is working well. When the PersonGuarantor form open the user can enter information as needed. If the user has a new record they are adding the following should happen:

When the Pencil button is pressed, the "PersonBrowser" form should open up. From this form they should be able to Press the "Select" button to select a person or press the "New" button to enter a new person. If Select is pressed the appliable IDs should be entered into the "PersonGuarantor" form.

It does not seem very complicated but because I am a code rookie, I have no idea how to accomplish this.

Any help someone could provide would be GREATLY appreciated.

Thanks!
dbrune
I am trying to repost this due to lack of response. Can anyone help me with this?
Dom DXecutioner
Reposting will definately not increase your chances of a response, if anything it might decrease it. Plus, cross-posting, and reposting are now allowed here at UA. Unfortunately, i was unable to find the form "CreditFaciility"
Fletch
There were a few posts on another thread that went off course for a little bit and has some more info on this topic. That link is included for anyone following this response. . . frown.gif

dbrune, I think I might have gotten it to work. I'm still having a hard time getting my hands around this database as it's somewhat complex. It seems like normalization may not have fully transpired in this database, though I'm not analyzing it that closely to be sure. At any rate, take a look at the attached database and tell me if that's what you want it to do or if you had something else in mind.

frown.gif

Edited by: babrandt on 08.31.04.
dbrune
The code you inserted is working better now. Couple things I am looking for:

1. On the PersonGuarantor form when the Pencil Button is pressed can you make it so the form opens to the PersonID from the PersonGuarantor screen
2. If there is no record on the PersonGuarantor screen (the user wants to add a new one) then when the Pencil button is pressed, the Person form should open instead of the PersonBrowser.

Thanks
Fletch
I think this meets your specifications
CODE
Private Sub OpenPersonAddGuarantor_Click()
    
If Not IsNull(Me.PersonID) Then
    DoCmd.OpenForm "PersonBrowser", , , "[PersonID]=" & Me.PersonID, , acDialog
Else
    DoCmd.OpenForm "Person", , , , , acDialog
End If
    
End Sub

However, not sure of the purpose of opening the Person form in your #2 spec. It will do that, but I'm guessing you want something more, like a means to select a person from this list and then add this to the PersonGuarantor form or something like that, but see if the above code does what you want.
dbrune
That worked great. thanks

I had to reverse the OpenForm lines but it is working the way I need it to. The only other thing on this form would be when the form is closed so in the On Close I need the Product form to refresh or the SubGuarantors subform to refresh so it shows the changes.

Any idea how to make that happen?
Fletch
Try
Forms("Product").subGuarantors.Form.Requery
in the Close event.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.