Carry a form's data forward code problem (1 Viewer)

Punice

Registered User.
Local time
Yesterday, 20:41
Joined
May 10, 2010
Messages
135
My code to carry some fields of a form to a new form and clear selected fields. It works, except for one combobox field & one text box (Me.Driver & Me.Material), whereas the other combo, text & date fields do work.) I've tried doing everything for a month before giving up and asking you experts for help. (BTW, I tried Allen Browne's code, but it hung up at a 'hasproperties' part of the his program.)Here is a bit of my code:private Sub CreateCarryOverForm_Lbl_Click()'This copies the form, but only the selected field value, to a new form DoCmd.RunCommand acCmdSelectRecord DoCmd.RunCommand acCmdCopy DoCmd.RunCommand acCmdRecordsGoToNew DoCmd.RunCommand acCmdSelectRecord DoCmd.RunCommand acCmdPaste Me.[Load#] = "" Me.Pudate = Null Me.Start = "" Me.Puloc = "" Me.Deldate = Null Me.Xdesc1 = "" Me.Plmiles = "" Me.LXfee1 = "" Me.Driver = "" 'error: not on list message Me.Finis = "" Me.Delloc = "" Me.LRate = "" Me.Xdesc2 = "" Me.LXfee2 = "" Me.Material = "" 'error: not on list messageEnd Sub"""" are "" in my sub-routine.
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 17:41
Joined
Aug 30, 2003
Messages
36,127
That's difficult to read. You might try setting those fields to Null instead of ""; some fields can't hold the zero length string.
 

Punice

Registered User.
Local time
Yesterday, 20:41
Joined
May 10, 2010
Messages
135
Yes, I know. I thought I deleted the post, so I could post my code in a more
normal format.
I tried using 'Null' for the two statements that work, but that didn't solve the problem. The error message was: "Update or CancelUpdate without AddNew or Edit".
 

Punice

Registered User.
Local time
Yesterday, 20:41
Joined
May 10, 2010
Messages
135
My code to carry some fields of a form to a new form and clear selected fields. It works, except for one combobox field & one text box (Me.Driver & Me.Material), whereas the other combo, text & date fields do work.)

I've tried doing everything for a month before giving up and asking you experts for help. (BTW, I tried Allen Browne's code, but it hung up at a 'hasproperties' part of the his program.)

Changing "" to Null didn't solve the problem.

Here is a bit of my code reformatted to make it easier to read:

Private Sub CreateCarryOverForm_Lbl_Click()
'This copies the form, but only the selected field value, to a new form
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
DoCmd.RunCommand acCmdRecordsGoToNew
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdPaste

Me.[LOADS#] = Null

Me.Pudate = Null
Me.Start = ""
Me.Puloc = ""
Me.Deldate = Null
Me.Xdesc1 = ""
Me.Plmiles = ""
Me.LXfee1 = ""
Me.Driver = ""
Me.Finish = ""
Me.Delloc = ""
Me.LRate = ""
Me.Xdesc2 = ""
Me.LXfee2 = ""
Me.Material = ""

End Sub


 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 17:41
Joined
Aug 30, 2003
Messages
36,127
So changing to:

Me.Driver = Null
Me.Material = Null

results in that error? In one of them required? Can you attach the db here?
 

Punice

Registered User.
Local time
Yesterday, 20:41
Joined
May 10, 2010
Messages
135
DB is proprietary property and I not permitted to share it.

When I omit the two 'Me' statements from the sub, all works just fine,

If I rename the objects in the associated table and use those names in the sub or reposition them in the sub, the error is encountered.

Iitially, I tried using Allen Browne's code to carry forward a form, but it hung up on the part if the code at 'hasproperties'. So, after trying the 'net for solutions, I ask this forum for help.
 

Users who are viewing this thread

Top Bottom