I've replace the If ctl.value = null with the isnull(ctl.value) and brilliant, it works - thank you. HOwever, after the message box displays, immediately afterwards displays an error: Runtime error 3021 No current record. Is there a way to stop this happending please?
Thanks you for all your help
I've put a * in the fields that I want filled in. I've put this code and nothing validates... any ideas? its like there's no validation on there at all!!
Private Sub Form_BeforeUpdate(Cancel As Integer)
' check field for * in tag and check if text entered and provide error
Dim Msg As String...
Hello MazeWorX
I've added the line Cancel = true before the ctl.getfocus line
However, nothing is happening when no data is entered for the tagged fields. Any idea why?
Thanks so much - this is very frustrating!
I've incorporated the code MaZeWorX suggested but on entering the data, i'm not getting any validation happening at all! Have I missed something.. incase anyone has nothing better to do, i've pasted the code against the form should there be any glaring reason its not working.. or perhaps its...
Ah, I see I need a Case else if others not met!
The case isn't quite working for the 9, 10. I do get the message box but I also want to make the term visible. I tried the following but it didn't like it! You can't have 2 results for the condition set then?
Private Sub...
I’m popping a bit of code behind a combo box called comboobjective on a form. If the user chooses certain objectives numbers, I want one text box to become visible, but if they pick any one of another list of values, then the other text becomes visible.
The IF does it (as I’ve put below) but...
Oh thanks. Yes I see - I've put another End If in there but now I get the msgbox pop up but when I click ok I'm now getting the following: Microsoft Visual Basic; runtime error '3021' No current record... any ideas please?
Sorry: this is the exact sub I have:
Private Sub Form_BeforeUpdate(Cancel As Integer)
' check field for * in tag and check if text entered and provide error
Dim Msg As String, Style As Integer, Title As String
Dim DL As String, ctl As Control
DL = vbNewLine & vbNewLine
For Each...
I wanted some code to verify users had entered info in some fields on a form. This code looks perfect but i'm getting an error saying: compile error: next without For... whats wrong please?
Dim Msg As String, Style As Integer, Title As String
Dim DL As String, ctl As Control
DL =...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.