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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save Button

Status
Not open for further replies.

jdwm2310

Technical User
Jul 26, 2001
396
US
Hi,

On my save button: when the user clicks on it,they will be asked "if the ticket is closed?" If they select yes...the ticket status combobox will show "closed" and the ticket will be saved...
If however they select "No"....then they will be prompt with another message box which states "would you like to route the ticket?" if they select yes the Route to combobox will enabled. The ticket will be saved and the ticket status combobox will show "Routed to" If they select No then the ticket will be saved and the Ticket Status combobox will show "Open"

I try playing with a code I hope someone can give me some pointers on this one thans:

Private Sub Save_Click()
On Error GoTo Err_Save_Click
If MsgBox("Is this Ticket Close?", vbYesNo + vbQuestion) = vbYes Then
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Me.Solved_by.Enabled
Me.Date_Closed.Enabled
Me.Ticket_Status = "Closed"

Else
MsgBox("Would you like to Route this ticket?", vbYesNo + vbQuestion) = vbYes
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Me.Route_To.Enabled
Me.Date_Routed_1.Enabled
Me.Ticket_Status = "Routed"

Exit Sub

Exit_Save_Click:
Exit Sub

Err_Save_Click:
MsgBox Err.Description
Resume Exit_Save_Click

End Sub
 
Nearly there.

You need a second if statement after the else.

IF MsgBox("Would you like to Route this ticket?", vbYesNo + vbQuestion) = vbYes THEN

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Me.Route_To.Enabled
Me.Date_Routed_1.Enabled
Me.Ticket_Status = "Routed"

ELSE
'Save the ticket and Ticket status combo box to show open.
ENDIF


Don't forget that for each IF, you need an ENDIF. You havn't closed off the 1st IF you used in the code you posted. Good Luck!
 
One more minor sugestion,

Replace the lines you use to save the record,ie,
Docmd.yuck arggg,blah,acsaverec with
me.dirty = false. Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top