what's wrong with this code????

Dgavilanes

Registered User.
Local time
Today, 22:56
Joined
Jun 25, 2001
Messages
109
Hope Pat reads this one ( need your help)

I have six fields in my form
Only 3 are required
When Approved then Effective and completed date is required, if Approval is missing but Effective and completed date are not then I need a warning.

Approval, Effective,completed dates, triggers Board report date.

The problem that I have is that after I entered received date and other field called lane requested it keeps requiring me to enter missing fields, the process may take up to six months before approval

hope it makes sense

Thanks please help


Dennis



<code>
Dim ok as Boolean
If Not IsNull(Me.Appvd) Then
If Not IsNull(Me.EffDate) Then
If Not IsNull(Me.CompDate) Then
'All fields completed
ok = True
Me.MBReportDate = DLookup("[BrDate]", "BR Dates", ?????? Enter criteria here ?????)
Else
'Compdate not completed
ok = False
Me.CompDate.SetFocus
End If
Else
'EffDate not completed
ok = False
Me.EffDate.SetFocus
End If
Else
'Appvd not completed
ok = False
Me.Appvd.SetFocus
Endif
If Not ok Then
MsgBox "Please complete missing field!"
Me.MBReportDate = Null
Cancel = True
End If
 
I can't give you any answers, BUT...
You'll have better chances getting answers if you use the word CODE between [] at the opening and /CODE between [] at the end.
Like this:
Code:
Dim ok as boolean

If Not IsNull(Me.Appvd) Then 
	If Not IsNull(Me.EffDate) Then 
		If Not IsNull(Me.CompDate) Then 
			'All fields completed 
			ok = True 
			Me.MBReportDate = DLookup("[BrDate]", "BR Dates", ?????? Enter criteria here ?????) 
		Else 
			'Compdate not completed 
			ok = False 
			Me.CompDate.SetFocus 
		End If 
	Else 
		'EffDate not completed 
		ok = False 
		Me.EffDate.SetFocus 
	End If 
Else 
	'Appvd not completed 
	ok = False 
	Me.Appvd.SetFocus 
Endif 

If Not ok Then 
	MsgBox "Please complete missing field!" 
	Me.MBReportDate = Null 
	Cancel = True 
End If
Have you tried using <>"" instead of Not IsNull?
(I am not sure! Just givin' a try)
Code:
Dim ok as boolean

If Me.Appvd<>"" Then 
	If Me.EffDate<>"" Then 
		If Me.CompDate<>"" Then 
			'All fields completed 
			ok = True 
			Me.MBReportDate = DLookup("[BrDate]", "BR Dates", ?????? Enter criteria here ?????) 
		Else 
			'Compdate not completed 
			ok = False 
			Me.CompDate.SetFocus 
		End If 
	Else 
		'EffDate not completed 
		ok = False 
		Me.EffDate.SetFocus 
	End If 
Else 
	'Appvd not completed 
	ok = False 
	Me.Appvd.SetFocus 
Endif 

If Not ok Then 
	MsgBox "Please complete missing field!" 
	Me.MBReportDate = Null 
	Cancel = True 
End If
 
Also, rather than use "", it is more efficient to use vbNullString.
 
Code >>>>

Thanks so much for you reply, I will test this over the weenkend to see how it goes.
I'm a (newbie) when it comes to VBA , thats why I rather ask for help and learn in the process, but I'm beginning to pick up things here and in books.
After I read something I need to see what it does, otherwise it doesnot zync.

Thanks to all members for your efforts

have a nice day

Dennis
 

Users who are viewing this thread

Back
Top Bottom