A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Message Box Problem



 
 
Thread Tools Display Modes
  #1  
Old May 6th, 2008, 07:55 PM posted to microsoft.public.access.forms
pushrodengine via AccessMonster.com
external usenet poster
 
Posts: 106
Default Message Box Problem

I need a message box to appear when the command button “AddIncident” is
pressed and one of the following:

Long Distance
Medical Transport
Traffic Accident
Trauma Transport

…is entered into the textbox “Type” and the textbox called “Disposition” is
left blank.

When Long Distance, Medical Transport, Traffic Accident, or Trauma Transport
is entered the user must also enter the Disposition.

I’m currently using a message box to inform the user when textbox “Type” is
left blank, but I need help to include the new message box into the code
without messing things up.

Thank you everyone for all your help in the past and your continued help!!


Below is the code I’m using:

------------------------------------------------------------------------------
------------------------------
Private Sub AddIncident_Click()
On Error GoTo Err_AddIncident_Click
Me!chkOKToClose = True
Select Case Me.Disposition
Case "Convalescent Care Facility"
Me.PatientID = Me.LastPatientID
Case "Facility Not-Listed"
Me.PatientID = Me.LastPatientID
Case "French"
Me.PatientID = Me.LastPatientID
Case "Medical Building"
Me.PatientID = Me.LastPatientID
Case "Paso Robles Airport"
Me.PatientID = Me.LastPatientID
Case "Prof. Building"
Me.PatientID = Me.LastPatientID
Case "Rendezvous with Helicopter"
Me.PatientID = Me.LastPatientID
Case "Residence"
Me.PatientID = Me.LastPatientID
Case "Sierra Vista"
Me.PatientID = Me.LastPatientID
Case "SLO Airport"
Me.PatientID = Me.LastPatientID
Case "Twin Cities"
Me.PatientID = Me.LastPatientID
Case Else

End Select

If IsNull([Type]) Then
Call MsgBox("To Add Incident you must first enter incident 'Type' then input
the required information.", vbExclamation, "Incident Log: ERROR")
Exit Sub
Else
Me.[PatientID] = Format([PatientID], "0000")

DoCmd.GoToRecord , , acNewRec
End If

Exit_AddIncident_Click:
Exit Sub

Err_AddIncident_Click:
MsgBox Err.Description
Resume Exit_AddIncident_Click
End Sub
------------------------------------------------------------------------------
------------------------------

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200805/1

  #2  
Old May 6th, 2008, 11:16 PM posted to microsoft.public.access.forms
AKphidelt
external usenet poster
 
Posts: 591
Default Message Box Problem

Alright, so create an on click event using code. Copy and paste this code in
to it

If IsNull(Me.Type) Then
MsgBox "You have not entered a type", vbcritical
Exit Sub
Else
Select Case Me.Type
Case "Long Distance", "Medical Transport", "Traffic Accident", "Trauma
Transport"
If IsNull(Me.Disposition) Then
MsgBox "You need to enter a disposition", vbCritical
Exit Sub
End If
End Select
End If



Try that


"pushrodengine via AccessMonster.com" wrote:

I need a message box to appear when the command button “AddIncident” is
pressed and one of the following:

Long Distance
Medical Transport
Traffic Accident
Trauma Transport

…is entered into the textbox “Type” and the textbox called “Disposition” is
left blank.

When Long Distance, Medical Transport, Traffic Accident, or Trauma Transport
is entered the user must also enter the Disposition.

I’m currently using a message box to inform the user when textbox “Type” is
left blank, but I need help to include the new message box into the code
without messing things up.

Thank you everyone for all your help in the past and your continued help!!


Below is the code I’m using:

------------------------------------------------------------------------------
------------------------------
Private Sub AddIncident_Click()
On Error GoTo Err_AddIncident_Click
Me!chkOKToClose = True
Select Case Me.Disposition
Case "Convalescent Care Facility"
Me.PatientID = Me.LastPatientID
Case "Facility Not-Listed"
Me.PatientID = Me.LastPatientID
Case "French"
Me.PatientID = Me.LastPatientID
Case "Medical Building"
Me.PatientID = Me.LastPatientID
Case "Paso Robles Airport"
Me.PatientID = Me.LastPatientID
Case "Prof. Building"
Me.PatientID = Me.LastPatientID
Case "Rendezvous with Helicopter"
Me.PatientID = Me.LastPatientID
Case "Residence"
Me.PatientID = Me.LastPatientID
Case "Sierra Vista"
Me.PatientID = Me.LastPatientID
Case "SLO Airport"
Me.PatientID = Me.LastPatientID
Case "Twin Cities"
Me.PatientID = Me.LastPatientID
Case Else

End Select

If IsNull([Type]) Then
Call MsgBox("To Add Incident you must first enter incident 'Type' then input
the required information.", vbExclamation, "Incident Log: ERROR")
Exit Sub
Else
Me.[PatientID] = Format([PatientID], "0000")

DoCmd.GoToRecord , , acNewRec
End If

Exit_AddIncident_Click:
Exit Sub

Err_AddIncident_Click:
MsgBox Err.Description
Resume Exit_AddIncident_Click
End Sub
------------------------------------------------------------------------------
------------------------------

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200805/1


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:03 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 OfficeFrustration.
The comments are property of their posters.