Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command Button Help!

Status
Not open for further replies.

Spec01

IS-IT--Management
Jul 21, 2005
73
CA
Hey I have just a minor problem, i have created a database with and main form with 3 command buttons 1=Computer Specs, 2= Software, 3= Printers. The problem is that when I click on the Computer Specs command button and start typing information in, if i click the exit button to go back to the main for it deletes very thing i put into the computer specs form. Now, the thing is if i do it the second time everything stays and nothing gets deleted. so i can work with it but it gets annoying having to go in and out of it twice just so that the info will stay there. please help if anyone knows a solution. Weird Problem.

Thanks,
 
In the event procedure of the exit button:
If Me.Dirty Then DoCmd.RunCommand acCmdSaveRecord

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
When I input that in to the event producre it doesn't close at all now.
 
What is ALL the code of the Click event procedure of the Exit button ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Private Sub Exit_Click()
On Error GoTo Err_Exit_Click


DoCmd.Close

Exit_Exit_Click:
Exit Sub

Err_Exit_Click:
MsgBox Err.Description
Resume Exit_Exit_Click

End Sub
 
I suggested this:
Private Sub Exit_Click()
If Me.Dirty Then DoCmd.RunCommand acCmdSaveRecord
DoCmd.Close
End Sub

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Do I replace your command with mine ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top