- Local time
- Today, 21:47
- Joined
- Jul 9, 2003
- Messages
- 17,597
Has she ever created Youtube content? Good voice, knowledgeable and experienced.
Exactly! She's a natural!
Has she ever created Youtube content? Good voice, knowledgeable and experienced.
"It would be nice if the Northwind 2 had some similar basic, but critical, info"Tony,
See. George spotted a secret within my message.![]()
Good voice, knowledgeable and experienced.
Yes. I recall a few years back that I was participant/listener on one of her evening CTUserGroups meetings.I understand that Pat was a regular presenter at local MS Access Groups...
(it's not really my video, it's mostly Pat!)
The same thing I have written that if anyone of the conditions will not met then it will pop up message.
Absolutely. I did something similar a few years back but it was very crude - A MsgBox on each event so I could figure out what the blazes was going on. Their demo is MUCH more practical and informative.Very helpful to see the Order of Events.
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Forms!frmTransactionsMain!lblReceipt.Visible = True Then
If CheckForEmpty = False Then
MsgBox "Please fill in the coloured fields"
Else
MsgBox "Do Action"
End If
End If
End Sub
Function CheckForEmpty() As Boolean
CheckForEmpty = True
ClearControlFormatting
Dim Ctrl As Control
For Each Ctrl In Me.Controls
If Ctrl.Tag = "Fill" Then
If IsNull(Ctrl) Or Len(Ctrl) = 0 Then
Ctrl.BackColor = RGB(153, 204, 255)
CheckForEmpty = False
End If
End If
Next
End Function
Sub ClearControlFormatting()
Dim Ctrl As Control
For Each Ctrl In Me.Controls
If Ctrl.Tag = "Fill" Then
Ctrl.backcolor = vbWhite
End If
Next
End Sub
Private Sub Form_Current()
ClearControlFormatting
End Sub
Good morning. @GinaWhipp has the best Form Validation sub I have ever seen. Place her code in your BeforeUpdate event and your life will be much easier!I have applied validation rule on before update event but I am getting compile error kindly check and suggest please. I have added the code and screenshot.
Code:Private Sub Form_BeforeUpdate(Cancel As Integer) If Forms!frmTransactionsMain!lblReceipt.Visible = True Then If CheckForEmpty = False Then MsgBox "Please fill in the coloured fields" Else MsgBox "Do Action" End If End If End Sub Function CheckForEmpty() As Boolean() CheckForEmpty = True ClearControlFormatting Dim Ctrl As Control For Each Ctrl In Me.Controls If Ctrl.Tag = "Fill" Then If IsNull(Ctrl) Or Len(Ctrl) = 0 Then Ctrl.BackColor = RGB(153, 204, 255) CheckForEmpty = False End If End If Next End Function Sub ClearControlFormatting() Dim Ctrl As Control For Each Ctrl In Me.Controls If Ctrl.Tag = "Fill" Then Ctrl.baccolor = vbWhite End If Next End Sub Private Sub Form_Current() ClearControlFormatting End Sub
It is showing compile error on "=" sign on CheckForEmpty in before update event.
Kindly suggest
Thanks @jdraw, i have removed () now no error but the form is not showing any response on blank fields. Kindly suggest.I would start by removing the brackets after Boolean() in your CheckForEmpty() function.
Really nothing to it. You would place the code in a standard module (outside of any of your forms), then in each of your forms' BeforeUpdate event you would call it with@NauticalGent , this is beyond my scope, may be this would work, thanks
If fValidateData Then
Cancel = True
Exit Sub
End If
Really nothing to it. You would place the code in a standard module (outside of any of your forms), then in each of your forms' BeforeUpdate event you would call it with
Code:If fValidateData Then Cancel = True Exit Sub End If
I have applied validation rule on before update event but I am getting compile error kindly check and suggest please. I have added the code and screenshot.
Code:Private Sub Form_BeforeUpdate(Cancel As Integer) If Forms!frmTransactionsMain!lblReceipt.Visible = True Then If CheckForEmpty = False Then MsgBox "Please fill in the coloured fields" Else MsgBox "Do Action" End If End If End Sub Function CheckForEmpty() As Boolean CheckForEmpty = True ClearControlFormatting Dim Ctrl As Control For Each Ctrl In Me.Controls If Ctrl.Tag = "Fill" Then If IsNull(Ctrl) Or Len(Ctrl) = 0 Then Ctrl.BackColor = RGB(153, 204, 255) CheckForEmpty = False End If End If Next End Function Sub ClearControlFormatting() Dim Ctrl As Control For Each Ctrl In Me.Controls If Ctrl.Tag = "Fill" Then Ctrl.backcolor = vbWhite End If Next End Sub Private Sub Form_Current() ClearControlFormatting End Sub
It is showing compile error on "=" sign on CheckForEmpty in before update event.
Kindly suggest
There is no such thing as a "blank". There are Null and ZeroLengthStrings . Access separates the meanings. There is also space. But "blank" has no meaning.
@ahmad_rmh You MUST cancel the event in order to prevent Access from saving the record and the cancel = True must go in the form's BeforeUpdate event using the code you posted.
If Forms!frmTransactionsMain!lblTransfer.Visible = True Then
Me.frmTransactionsSub.Enabled = False
End if
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Forms!frmTransactionsMain!lblReceipt.Visible = True Then
If CheckForEmpty = False Then
MsgBox "Please fill in the coloured fields"
Cancel = True
Exit Sub
End If
End If
End Sub
Function CheckForEmpty() As Boolean
CheckForEmpty = True
ClearControlFormatting
Dim Ctrl As Control
For Each Ctrl In Me.Controls
If Ctrl.Tag = "Fill" Then
If IsNull(Ctrl) Or Len(Ctrl) = 0 Then
Ctrl.BackColor = RGB(153, 204, 255)
CheckForEmpty = False
End If
End If
Next
End Function
Sub ClearControlFormatting()
Dim Ctrl As Control
For Each Ctrl In Me.Controls
If Ctrl.Tag = "Fill" Then
Ctrl.BackColor = vbWhite
End If
Next
End Sub
Private Sub Form_Current()
ClearControlFormatting
End Sub
Private Sub Form_AfterUpdate()
Me.Refresh
If Forms!frmTransactionsMain!lblReceipt.Visible = True Then
Me.frmTransactionsSub.Enabled = True
Me.frmTransactionsSub!ItemsFK.SetFocus
End If
End Sub