You tried to assign the Null value to a variable that is not a Variant data type. (Error 3162)
You tried to assign a Null value to a variable that is not a Variant data type. Use the Dim statement to declare the variable as a Variant, and then try the operation again.
Here's the situation as best I can describe it:
I am currently using Access 2003
Form - frmProperties
subform - frmPropertiesMortgageCompanies
control on subform - txtMortgageCompany
Private Sub txtMortgageCompany_AfterUpdate()
The following References are used:
Visual Basic for Applications
Microsoft Access 11.0 Object Library
Microsoft Visual Basic for Applications Extensibility 5.3
Microsoft DAO 3.6 Object Library
Microsoft ActiveX Data Objects 2.1 Library
OLE Automation
Options - in order to find out what was happening, I set the Error Trapping to "Break on All Errors", but it does not break when this error comes up.
This error occurs every time that I enter any information in the combo box the first time. Once you click OK (only OK and Help on error message box and Help gives the message that is at the top), the information is accepted and it moves on to the "Not in List" code.
Private Sub txtMortgageCompany_NotInList(NewData As String, Response As Integer)
Dim strMessage As String
Dim db As Database
Dim rs As Recordset
strMessage = "Are you sure you want to add '" & NewData & _
"' to the list of Mortgage Companies?"
If Confirm(strMessage) Then
End Sub
I have tried to give you every thing that I can, but I just don't know what else to do. There are not variables that need to be set and I can't get this error to show me where the problem is.
Any help or answers that you can give me will be greatly appreciated. Thanking you in advance.
BJ
You tried to assign a Null value to a variable that is not a Variant data type. Use the Dim statement to declare the variable as a Variant, and then try the operation again.
Here's the situation as best I can describe it:
I am currently using Access 2003
Form - frmProperties
subform - frmPropertiesMortgageCompanies
control on subform - txtMortgageCompany
Private Sub txtMortgageCompany_AfterUpdate()
txtPropertieID = Forms![frmProperties]![txtPropertieID]
Forms![frmProperties]![txtPMCID] = txtPMCID
txtMCAddress1 = txtMortgageCompany.Column(2)
txtMCAddress2 = txtMortgageCompany.Column(3)
txtMCCity = txtMortgageCompany.Column(4)
txTMCState = txtMortgageCompany.Column(5)
txtMCZip = txtMortgageCompany.Column(6)
End SubForms![frmProperties]![txtPMCID] = txtPMCID
txtMCAddress1 = txtMortgageCompany.Column(2)
txtMCAddress2 = txtMortgageCompany.Column(3)
txtMCCity = txtMortgageCompany.Column(4)
txTMCState = txtMortgageCompany.Column(5)
txtMCZip = txtMortgageCompany.Column(6)
The following References are used:
Visual Basic for Applications
Microsoft Access 11.0 Object Library
Microsoft Visual Basic for Applications Extensibility 5.3
Microsoft DAO 3.6 Object Library
Microsoft ActiveX Data Objects 2.1 Library
OLE Automation
Options - in order to find out what was happening, I set the Error Trapping to "Break on All Errors", but it does not break when this error comes up.
This error occurs every time that I enter any information in the combo box the first time. Once you click OK (only OK and Help on error message box and Help gives the message that is at the top), the information is accepted and it moves on to the "Not in List" code.
Private Sub txtMortgageCompany_NotInList(NewData As String, Response As Integer)
Dim strMessage As String
Dim db As Database
Dim rs As Recordset
strMessage = "Are you sure you want to add '" & NewData & _
"' to the list of Mortgage Companies?"
If Confirm(strMessage) Then
DoCmd.OpenForm "frmMortgageCompanies", , , , acFormAdd, acDialog
Response = acDataErrAdded
ElseResponse = acDataErrAdded
If MsgBox(NewData & " is not a Mortgage Company in the list. " & vbCrLf & _
"Please pick a Mortgage Company from the list.", vbOKOnly) = vbOK Then
End If"Please pick a Mortgage Company from the list.", vbOKOnly) = vbOK Then
Me!txtMortgageCompany.Undo
Response = acDataErrDisplay
End IfResponse = acDataErrDisplay
End Sub
I have tried to give you every thing that I can, but I just don't know what else to do. There are not variables that need to be set and I can't get this error to show me where the problem is.
Any help or answers that you can give me will be greatly appreciated. Thanking you in advance.
BJ