|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Invalid Use of Null - VBA
The following code is activated when a user clicks on a button. It is supposed to go to the next record. If the next record is empty, I want Access to jump back to the previous record and issue a message indicated it is the end of the records.
This works fine until I get to the end of the record set. Then I get an "invalid use of Null" warning. Any ideas? Code:
DoCmd.GoToRecord , , acNext
Dim strParty As Integer
strParty = Me.Party_Type_ID
If strParty < 1 Then
DoCmd.GoToRecord , , acPrevious
MsgBox "End of Record", vbOKOnly
End If
|
|
#2
|
||||
|
||||
|
check for is null instead of greater than 1
__________________
Come JOIN the party!!! Quote of the Month: Retirement: Because you've given so much of yourself to the company that you don't have anything left we can use. Questions to Ponder: What do you do when you see an endangered animal eating an endangered plant? iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm") copyright© 2008 sbenj69 |
|
#3
|
|||
|
|||
|
I tried that - it gives me a type-mismatch. Does it matter that Party_Type_ID is an autonumber?
|
|
#4
|
|||
|
|||
|
I got it!!
Code:
DoCmd.GoToRecord , , acNext
if isnull(Me.Party_Type_ID) then
DoCmd.GoToRecord , , acPrevious
MsgBox "End of Record", vbOKOnly
End If
Thanks for the help! |
|
#5
|
||||
|
||||
|
glad you got it working
|
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Invalid Use of Null - VBA |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|