S
stockwell43
Hello,
I have some code that with a click of a button will copy certain fields to a
new record. However, I am having a problem where if the first name is blank,
I get a null error:
Run time error 94
Invalid use of Null
Here is the code on the top of my code window:
Option Compare Database
Private ctrl1 As String 'CustLast
Private ctrl2 As String 'DrawType
Private ctrl3 As String 'CloserName
Private ctrl4 As String 'CustFirst
Private ctrl5 As String 'LoanNumber
Here is the code behind the button:
Private Sub cmdCopy_Click()
ctrl1 = BorrLast
ctrl2 = BorrFirst
ctrl3 = BankCenter
ctrl4 = Officer
ctrl5 = ProcName
DoCmd.GoToRecord acForm, "frmconstructionsloans", acNewRec 'goes to new
record
BorrLast = ctrl1
BorrFirst = ctrl2
BankCenter = ctrl3
Officer = ctrl4
ProcName = ctrl5
End Sub
it works fine if all the fields are fill in but if one is left blank, I get
the error. How can I get this to work if any of the fields are blank?
Thanks!!!
I have some code that with a click of a button will copy certain fields to a
new record. However, I am having a problem where if the first name is blank,
I get a null error:
Run time error 94
Invalid use of Null
Here is the code on the top of my code window:
Option Compare Database
Private ctrl1 As String 'CustLast
Private ctrl2 As String 'DrawType
Private ctrl3 As String 'CloserName
Private ctrl4 As String 'CustFirst
Private ctrl5 As String 'LoanNumber
Here is the code behind the button:
Private Sub cmdCopy_Click()
ctrl1 = BorrLast
ctrl2 = BorrFirst
ctrl3 = BankCenter
ctrl4 = Officer
ctrl5 = ProcName
DoCmd.GoToRecord acForm, "frmconstructionsloans", acNewRec 'goes to new
record
BorrLast = ctrl1
BorrFirst = ctrl2
BankCenter = ctrl3
Officer = ctrl4
ProcName = ctrl5
End Sub
it works fine if all the fields are fill in but if one is left blank, I get
the error. How can I get this to work if any of the fields are blank?
Thanks!!!