Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2008

Tip: Looking for answers? Try searching our database.

Message Box Problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
pushrodengine - 06 May 2008 19:55 GMT
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
------------------------------------------------------------------------------
------------------------------
akphidelt - 06 May 2008 23:16 GMT
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
                     

> I need a message box to appear when the command button “AddIncident” is
> pressed and one of the following:
[quoted text clipped - 69 lines]
> ------------------------------------------------------------------------------
> ------------------------------
pushrodengine - 21 May 2008 15:07 GMT
Thank you, but this code did not work.

>Alright, so create an on click event using code. Copy and paste this code in
>to it
[quoted text clipped - 21 lines]
>> ------------------------------------------------------------------------------
>> ------------------------------
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.