If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Save and Close Button
I am designing a database containing patient information. On the main report
screen I have a drop down to choose the patient. I also have a button that opens a form to add a new patient if needed. My question is how do I add a button to "Save and Close". the new patient form after the information is added? Rab |
#2
|
|||
|
|||
Save and Close Button
1. Set the command button's On Click property to:
[Event Procedure] 2. Click the Build button (...) beside this property. Access opens the code window. 3. Between the "Private Sub..." and "End Sub", enter these 2 lines: If Me.Dirty Then Me.Dirty = False DoCmd.Close acForm, Me.Name Use error handling: the first line will throw an error if the record cannot be saved for any reason (e.g. a required field is left blank.) -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Rabastan" wrote in message ... I am designing a database containing patient information. On the main report screen I have a drop down to choose the patient. I also have a button that opens a form to add a new patient if needed. My question is how do I add a button to "Save and Close". the new patient form after the information is added? Rab |
#3
|
|||
|
|||
Save and Close Button
On your new patient form you need a Close button with the following code in
the Click event: DoCmd.Close. On your form where you have the drop down to choose a patient, you need a New Patient button with the following code in the Click event: DoCmd.OpenForm "NameOfNewPatientForm",,,,acDialog When you click this button, your new patient form will open. After you enter the new patient and click the Close button on that form, the new patient form will close automatically saving the new patient and then any code after the above line of code will execute. Steve "Rabastan" wrote in message ... I am designing a database containing patient information. On the main report screen I have a drop down to choose the patient. I also have a button that opens a form to add a new patient if needed. My question is how do I add a button to "Save and Close". the new patient form after the information is added? Rab |
Thread Tools | |
Display Modes | |
|
|