|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
When box is not filled in, don't let user save
Hi,
I have this code for a button: Private Sub Details_GotFocus() If [Sample Name] = Empty Then MsgBox "You cannot save anything in Details", vbOkay Else DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70 End If End Sub The function I want to produce is when the button is clicked on, it should open another Form and if a certain field (Sample Name) is left empty, then it will display a message box. Why doesn't this code work. There's no errors but it doesn't do what I want it to do. Thanks |
|
#2
|
|||
|
|||
|
Change the syntax slightly,
If IsNull(Sample_Name) Then Msgbox...... However I would not use the On Focus for the control to trigger the event. Typically you would use the On Click Event or After Update. lwells |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft Access Development > When box is not filled in, don't let user save |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|