Full Version: place,county and post
UtterAccess Forums > Microsoft® Access > Access Forms
rberbe2002
Hi, I have three fields on a form..

Place
County
Postcode

on the update of place i want to do

If IsNull(County) and Place is not london then

exit sub

Else

end if

how do i write this correct if possible to do
Edited by: rberbe2002 on Tue May 13 11:06:42 EDT 2008.
fkegley
If IsNull(Me.County) And Me.Place <> "London" Then
xit Sub
Else
End If
rberbe2002
Thats what I have tried.. and when i dont put london in place it doesnt run the code. but when i do put london it runs.. and i need it the other way..
My code is
CODE
        Me.CodeJOutbound_AddressPlace.Value = UCase(CodeJOutbound_AddressPlace)
        If IsNull(Me.CodeJOutbound_AddressCounty) And Me.CodeJOutbound_AddressPlace <> "LONDON" Then
            Exit Sub
        
        Else
        
            varOrigin = DCount("[UkPlaces_LongName]", "tblToolsPlacesUkPlaces", "[CodeJOutbound_ShipmentOrigin] = [UkPlaces_LongName]")
        
            If varOrigin > 0 Then
          
          
            Else
          
                    tmpReply = MsgBox("This place does not exsist." & vbCr & vbCr & "Would you like to add this place." & vbCr & vbCr & "Select 'Yes' to add place and 'No' to exit.          ", vbInformation + vbYesNoCancel, "Places")
                  
                    If tmpReply = vbYes Then
              
                    ElseIf tmpReply = vbNo Then
              
                        Exit Sub
              
                    End If
          
            End If
                
        End If
theDBguy
Make sure you have
ption Compare Database
on the top of your code module and try changing your code to:
If IsNull(Me.CodeJOutbound_AddressCounty) And Me.CodeJOutbound_AddressPlace <> "london" Then
Hope that helps...
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.