Null error




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
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?





Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question