Can't assign value

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.
 
R

redFred

Resolved!

I inserted the following prior to the failing line.

Me!Jobfrm!VisitsBCfrm.Form.txtholdFocus.SetFocus

Upon reflection -- duh!?
 

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

Top