I have a doc# that is never the same lenght. what i want to do is, create a button that will add the letters
"CONT-1" after the doc#...and CONT-2 all the way upto
CONT-10...It would count everytime the press the button..I have the following code that was working fine...all of the sudden i am getting an error that states
"INVALID USE OF NULL" I have not really changed anything..
Can someone look at my code and see if you can figure it out
Thanks
Dim Count As Integer, Found As Integer, Length As Integer
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
DoCmd.SetWarnings 0
Found = 0
Count = 1
If Right$(ManifestNu, 2) = "10" Then
MsgBox "You Have Exceeded The Number of Continuation Sheets Allowed For This Manifest. Call Azusa Systems Dept. For Support!"
Exit Sub
End If
For Count = 1 To 9
If (Right$(ManifestNu, 7) = "-CONT-" & Count) Then
Length = Len(ManifestNu) - 7
ManifestNu = Left(ManifestNu, Length) & "-CONT-" & CStr(Count + 1)
Found = 1
Count = 9
End If
Next Count
If Found = 0 Then
ManifestNu = ManifestNu & "-CONT-" & CStr(1)
End If
end sub
"CONT-1" after the doc#...and CONT-2 all the way upto
CONT-10...It would count everytime the press the button..I have the following code that was working fine...all of the sudden i am getting an error that states
"INVALID USE OF NULL" I have not really changed anything..
Can someone look at my code and see if you can figure it out
Thanks
Dim Count As Integer, Found As Integer, Length As Integer
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
DoCmd.SetWarnings 0
Found = 0
Count = 1
If Right$(ManifestNu, 2) = "10" Then
MsgBox "You Have Exceeded The Number of Continuation Sheets Allowed For This Manifest. Call Azusa Systems Dept. For Support!"
Exit Sub
End If
For Count = 1 To 9
If (Right$(ManifestNu, 7) = "-CONT-" & Count) Then
Length = Len(ManifestNu) - 7
ManifestNu = Left(ManifestNu, Length) & "-CONT-" & CStr(Count + 1)
Found = 1
Count = 9
End If
Next Count
If Found = 0 Then
ManifestNu = ManifestNu & "-CONT-" & CStr(1)
End If
end sub