Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

add letters to a field

Status
Not open for further replies.

dvannoy

MIS
May 4, 2001
2,765
US
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

 
The code looks okay. Are you sure you don't have a record where ManifestNu is set to NULL? Terry M. Hoey
th3856@txmail.sbc.com
While I don't mind e-mail messages, please post all questions in these forums for the benefit of all members.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top