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 Programming / April 2005

Tip: Looking for answers? Try searching our database.

BeforeUpdate

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alex - 27 Apr 2005 23:39 GMT
How can I add to the current code (below) a test to make sure that if
Location 1 field is not 0 or is not null and Location 1 RorM field is null
that a msgbox appears stating that "Location 1 RorM must be completed."? I've
tried the following, but it doesn't work.  Any ideas how I can add it to the
BeforeUpdate code that is already being used? Thanks.

I've tried:
If me.Location_1 = 0 or IsNotNull(me.Location_1) And Location 1_RorM = ""
then msgbox ("You must pick R or M")
Exit Sub
End If

Current Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Nz(Me!Welded_By_Robot, 0) = 0 Then
       Cancel = True    'Don't let the record be saved
       Dim strMsg As String    'To assign the message's text
       strMsg = "You must choose Yes or No"
       If MsgBox(strMsg, vbOKCancel + vbExclamation, _
               "Incomplete Data") = vbCancel Then    'If user response is
"Cancel"
           Me.Undo

       End If
       End If
End Sub
Marshall Barton - 28 Apr 2005 01:04 GMT
See below.
Signature

Marsh
MVP [MS Access]

>How can I add to the current code (below) a test to make sure that if
>Location 1 field is not 0 or is not null and Location 1 RorM field is null
[quoted text clipped - 21 lines]
>        End If
>        End If

If me.Location_1 = 0 AND Not IsNull(me.Location_1) _
                                        And IsNull(Location 1_RorM) _
            then msgbox ("You must pick R or M")
    Cancel = True
End If

>End Sub
 
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.