Hi can anyone help me with this Run-time Error!
I don't understand what it means here's full message:
Run-time Error '2471':
The expresssion you entered as a query parameter produced this error:
'The object doesn't contain the Automation Object 'B1322N1GB,"
The following is the code used before the above error message kicks in:
I don't understand what it means here's full message:
Run-time Error '2471':
The expresssion you entered as a query parameter produced this error:
'The object doesn't contain the Automation Object 'B1322N1GB,"
The following is the code used before the above error message kicks in:
Code:
Dim ModelNo 'Declare the ModelNo variable
Dim Char1 'Declare the Char1 variable
Dim Char2 'Declare the Char2 variable
Dim Char3 'Declare the Char3 variable
Dim Char4 'Declare the Char4 variable
Dim Char5 'Declare the Char5 variable
Dim Char6 'Declare the Char6 variable
Dim Char7 'Declare the Char7 variable
Dim Char8 'Declare the Char8 variable
Dim Char9 'Declare the Char9 variable
'Assign the value of the txtModelNo field to the ModelNo variable
ModelNo = Me![txtModelNo].Value
Char1 = Left(ModelNo, 1)
Char2 = Mid(ModelNo, 2, 1)
Char3 = Mid(ModelNo, 3, 1)
Char4 = Mid(ModelNo, 4, 1)
Char5 = Mid(ModelNo, 5, 1)
Char6 = Mid(ModelNo, 6, 1)
Char7 = Mid(ModelNo, 7, 1)
Char8 = Mid(ModelNo, 8, 1)
Char9 = Right(ModelNo, 1)
If Char1 = "B" Or Char1 = "D" Or Char1 = "H" Or Char1 = "N" Or Char1 = "S" Then
If Char1 = "B" Then
Char1 = "8"
ElseIf Char1 = "D" Then
Char1 = "O"
ElseIf Char1 = "H" Then
Char1 = "N"
ElseIf Char1 = "N" Then
Char1 = "H"
ElseIf Char1 = "S" Then
Char1 = "5"
End If
End If
ModelNo = Char1 & Char2 & Char3 & Char4 & Char5 & Char6 & Char7 & Char8 & Char9
If DCount("[strModelNo]", "[tblAJL_Test]", "[strModelNo]=" & Me![txtModelNo]) = 0 Then
'Create the new record and move to the next record
DoCmd.GoToRecord , "frmAJL_Test", acNext, 1
'Assign the new model number to the txtModelNo field
Me![txtModelNo].Value = ModelNo
Me![txtAppCode].Value = AppCode
Me![txtModelNo2].Value = ModelNo2
Else 'If already exists
'Go to the next record
DoCmd.GoToRecord , "frmAJL_Test", acNext, 1
'Assign the new model number to the txtModelNo field
Me![txtModelNo].Value = ModelNo
Me![txtAppCode].Value = AppCode
Me![txtModelNo2].Value = ModelNo2
End If
[END CODE]
The "B1322N1GB" of the error message is obtained from the txtModelNo object on the form which is the strModelNo field in the underlaying table.
I am trying to create a variation of the model number, but want check weather it exists before it is created and if it already exist, then don't create it but create another variation and do the same process.
Any assistance would be appreciated.
John