Maximum length when declaring a variable As String

Alan R

Registered User.
Local time
Today, 10:31
Joined
Sep 11, 2006
Messages
70
Hi,

I have used the following code to create a duplicate record when up-issuing a certificate:

Private Sub DuplicateRecord_Click()

Dim sReferenceNumber As String
Dim sProject As String
Dim sItem_Name As String
Dim sItem_description As String
Dim sPart_Number As String
Dim sManufacturer_ID As String
Dim sExemptionNumber As String
Dim sExemptionDeviationCode As String
Dim sExemptionDeviation_Statement As String
Dim sNotes As String
Dim sIssueNumber As String


sReferenceNumber = ReferenceNumber
sProject = Project
sItem_Name = Item_Name
sItem_description = Item_description
sPart_Number = Part_Number
sManufacturer_ID = Manufacturer_ID
sExemptionNumber = ExemptionNumber
sExemptionDeviationCode = ExemptionDeviationCode
sExemptionDeviation_Statement = ExemptionDeviation_Statement

sNotes = Notes
sIssueNumber = IssueNumber

DoCmd.GoToRecord , , acNewRec

ReferenceNumber = sReferenceNumber
Project = sProject
Item_Name = sItem_Name
Item_description = sItem_description
Part_Number = sPart_Number
Manufacturer_ID = sManufacturer_ID
ExemptionNumber = sExemptionNumber
ExemptionDeviationCode = sExemptionDeviationCode
ExemptionDeviation_Statement = sExemptionDeviation_Statement

Notes = sNotes
IssueNumber = (sIssueNumber + 1)

sReferenceNumber = ""
sProject = ""
sItem_Name = ""
sItem_description = ""
sPart_Number = ""
sManufacturer_ID = ""
sExemptionNumber = ""
sExemptionDeviationCode = ""
sExemptionDeviation_Statement = ""
sNotes = ""
sIssueNumber = ""

exit_DuplicateRecord_Click:
Exit Sub

err_DuplicateRecord_Click:
MsgBox Err.Description
Resume exit_DuplicateRecord_Click

End Sub

Everything works fine with the exception of those in red. It doesn't copy across the textassociated with these fields. The only difference that i can see from the other fields is that Deviation Code is a text box but set to 255 (whereas the other text fields are set to 50) characters and Deviation Statement is a memo, so could it be the size of the fields?

How can i arrange it such these fields are copied across as well.

Regards

Alan
 
Sorted

Hi,

Sorted this one, would help if i could spell correctly. Must learn to use the spill chocker.

Alan
 

Users who are viewing this thread

Back
Top Bottom