S
Stockwell43
hello,
I have a button on my form that will carry over some field information from
the current record to a new record. Here is what I have at the very top of my
code for the form:
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
And here is the code behind the button:
Private Sub cmdCopy_Click()
ctrl1 = CustLast
ctrl2 = DrawType
ctrl3 = CloserName
'ctrl4 = CustFirst
ctrl5 = LoanNumber
DoCmd.GoToRecord acForm, "frmconstructionsloans", acNewRec 'goes to new
record
CustLast = ctrl1
DrawType = ctrl2
CloserName = ctrl3
'CustFirst = ctrl4
LoanNumber = ctrl5
End Sub
It works fine except for one thing, if ALL the fields are not filled in
let's say DrawType is blank. When you click the button an error message pops
up saying: Run time error 94, invalid use of null.
How can I stop this from popping up? I am almost sure the users will for get
to fill in all four field and if this pops up it will show my code. Does
anyone have any ideas??
Thanks!!!
I have a button on my form that will carry over some field information from
the current record to a new record. Here is what I have at the very top of my
code for the form:
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
And here is the code behind the button:
Private Sub cmdCopy_Click()
ctrl1 = CustLast
ctrl2 = DrawType
ctrl3 = CloserName
'ctrl4 = CustFirst
ctrl5 = LoanNumber
DoCmd.GoToRecord acForm, "frmconstructionsloans", acNewRec 'goes to new
record
CustLast = ctrl1
DrawType = ctrl2
CloserName = ctrl3
'CustFirst = ctrl4
LoanNumber = ctrl5
End Sub
It works fine except for one thing, if ALL the fields are not filled in
let's say DrawType is blank. When you click the button an error message pops
up saying: Run time error 94, invalid use of null.
How can I stop this from popping up? I am almost sure the users will for get
to fill in all four field and if this pops up it will show my code. Does
anyone have any ideas??
Thanks!!!