clearing data on new form

briandavis

Registered User.
Local time
Today, 12:47
Joined
May 18, 2004
Messages
15
I used the tool button wizard to create a button that duplicates a form. On my form there are several checkboxes. How can I set it up so that when the user hits the button to duplicate the form that all checkboxes in the new form will be unchecked.
 
Are you duplicating a form or a record?

If the latter, you could try...
Code:
Private Sub Command10_Click()
On Error GoTo Err_Command10_Click

    DoCmd.RunCommand acCmdSelectRecord
    DoCmd.RunCommand acCmdCopy
    DoCmd.RunCommand acCmdRecordsGoToNew
    DoCmd.RunCommand acCmdPasteAppend
    Me.CheckBox1.Value = 0 ' zero = false or no , -1 = true or yes
    Me.CheckBox2.Value = 0
    Me.CheckBox3.Value = 0

Exit_Command10_Click:
    Exit Sub

Err_Command10_Click:
    MsgBox Err.Number & " - " & Err.Description
    Resume Exit_Command10_Click
    
End Sub
HTH
 
I'm copying a form. Also, I have 40 checkboxes on the form. Is there a way to write the code so that will look for this particular type of object on the form and clear it out rather than entering a line of code for each checkbox.

Thanks
 
Why are you copying a form? If the check boxes are filled in the copied form then your data source must be to a table for records that already exist. Not sure I understand what you are trying to do but you could set the new form to open to a new record.
 
The form is for a daily schedule of employees. The checkboxes indicate that a certain position is being worked for overtime as well as for other calculations. I am copying the form because from day to day the schedule contains about 80 to 90 percent of the same information. This way we can save time by not always having to do a schedule from scratch. However, the fact of whether or not a spot is worked for overtime is more random. For example area one is an overtime spot today because the regular person has an off day. Tomorrow they are back and this is not overtime.
 
I'm copying a form
- NO, you are copying the current record that is visible in the form.
Is there a way to write the code so that will look for this particular type of object on the form and clear it out rather than entering a line of code for each checkbox.
YES, use the fields collection of the current form. There are examples in help or if you search here, you should find code examples.
 
Sorry,I just got back from vacation.

I tried searching and came up empty. Any clues on the key words I should use in the search?

Thanks
 

Users who are viewing this thread

Back
Top Bottom