How to clear fields in acNewRec

kdsdata

New member
Local time
Today, 02:41
Joined
Mar 14, 2011
Messages
1
When I open a new record via code in a command button with:
Code:
DoCmd.GoToRecord , , acNewRec
I wind up with left over data in "logic fields" from the record I was on.

For example. Instead of the checkbox or option buttion, I use a happy or sad face when the data is set to either yes or no.

When the code runs the acNewRec, the face stays the same as it was at the record I was on.

I can't set (clear) the face before going to the new record, because that would change the record I was at.

I could run through all the logic fields after I go to the new record, but that sets the data to Yes or No. And this is the problem, I don't "want" to do that (set the data to Yes or No). But, the only reason is that I haven't done it before, which means that a lot of records have logic fields that are not set.

If there is a way to clear the faces, great. If not, then I'll go through the database and fix the no set logic fields.

Any suggestions will be greatly appreciated.
 
When I open a new record via code in a command button with:
Code:
DoCmd.GoToRecord , , acNewRec
I wind up with left over data in "logic fields" from the record I was on.

For example. Instead of the checkbox or option buttion, I use a happy or sad face when the data is set to either yes or no.

When the code runs the acNewRec, the face stays the same as it was at the record I was on.

I can't set (clear) the face before going to the new record, because that would change the record I was at.

I could run through all the logic fields after I go to the new record, but that sets the data to Yes or No. And this is the problem, I don't "want" to do that (set the data to Yes or No). But, the only reason is that I haven't done it before, which means that a lot of records have logic fields that are not set.

If there is a way to clear the faces, great. If not, then I'll go through the database and fix the no set logic fields.

Any suggestions will be greatly appreciated.

I use this to "clear" fields in a form that is a subform in a search box when a command button "Clear Form" is pressed. You should be able to adapt it for your use. Note that the names are for the text boxes in the form and NOT the actual fields in the DB.

On Error GoTo Err_CmdClear_Click

Me.txtDate_Rcvd = Null
Me.txtlast_name = Null
Me.txtfirst_name = Null
Me.txtaddress = Null
Me.txtLocation = Null
Me.txtComments = Null
Me.tbl2010_Data_subform.Requery

Exit_CmdClear_Click:
Exit Sub

Err_CmdClear_Click:
MsgBox Err.Description
Resume Exit_CmdClear_Click

End Sub
 

Users who are viewing this thread

Back
Top Bottom