R
redFred
Help! I cannot determine why this fails after it succeeds.
The following code is attached to a button to add a new job and its visits.
I can select a client and successfully add multiple jobs. However, when I
select a different client and attempt to add a job I get '2448 can't assign a
value to this object', highlighting the last line here.
Please, does anyone have a clue for me?
'ADD JOB RECORD
Me!Jobfrm!Invoicefrm.SetFocus
Me!Jobfrm!Invoicefrm.Form.AllowDeletions = True
Me!Jobfrm!Invoicefrm.Form.AllowAdditions = True
DoCmd.GoToRecord , , acNewRec
Me!Jobfrm!Invoicefrm.Form!InvNum = DMax("InvNum", "tbl 2 Job") + 1
Me!Jobfrm!Invoicefrm.Form!txtEnterDate = Date
Me!Jobfrm!Invoicefrm.Form!txtStartDate = Date + 1
Me!Jobfrm!Invoicefrm.Form!txtEndDate = Date + 1
Me!Jobfrm!Invoicefrm.Form!txtClientID = Forms![frm1 Client]!txtClientID
If Me.Dirty Then Me.Dirty = False
'ADD VISITS RECORDs
Forms![frm1 Client].txtAddingJob = 1
Me!Jobfrm![VisitsBCfrm].Form.AllowAdditions = True
Me!Jobfrm![VisitsBCfrm].Form.AllowDeletions = True
Me!Jobfrm![VisitsBCfrm].Form.InvNum = Me!Jobfrm!Invoicefrm.Form!InvNum
Thanks.
The following code is attached to a button to add a new job and its visits.
I can select a client and successfully add multiple jobs. However, when I
select a different client and attempt to add a job I get '2448 can't assign a
value to this object', highlighting the last line here.
Please, does anyone have a clue for me?
'ADD JOB RECORD
Me!Jobfrm!Invoicefrm.SetFocus
Me!Jobfrm!Invoicefrm.Form.AllowDeletions = True
Me!Jobfrm!Invoicefrm.Form.AllowAdditions = True
DoCmd.GoToRecord , , acNewRec
Me!Jobfrm!Invoicefrm.Form!InvNum = DMax("InvNum", "tbl 2 Job") + 1
Me!Jobfrm!Invoicefrm.Form!txtEnterDate = Date
Me!Jobfrm!Invoicefrm.Form!txtStartDate = Date + 1
Me!Jobfrm!Invoicefrm.Form!txtEndDate = Date + 1
Me!Jobfrm!Invoicefrm.Form!txtClientID = Forms![frm1 Client]!txtClientID
If Me.Dirty Then Me.Dirty = False
'ADD VISITS RECORDs
Forms![frm1 Client].txtAddingJob = 1
Me!Jobfrm![VisitsBCfrm].Form.AllowAdditions = True
Me!Jobfrm![VisitsBCfrm].Form.AllowDeletions = True
Me!Jobfrm![VisitsBCfrm].Form.InvNum = Me!Jobfrm!Invoicefrm.Form!InvNum
Thanks.