Created a button through button wizard that is supposed to open a form to add a new record, but all of the fields don't clear out. Only some fields clear and other fields actually populate data from another record.
Snip1 shows my form with a record selected. When I click the 'New Waste' button, you can see that the record ID goes to '(New)', but the fields actually populate data from another record.
This even happens if I set 'Data Entry' to yes for the form.
here's the code behind my button:
I even commented out my code for duplicating my record just in case but that didn't make a different.
edit: this problem persists in a backup database that only contains one test record. The button pre-populates data that doesn't exist in the back-up database.
Snip1 shows my form with a record selected. When I click the 'New Waste' button, you can see that the record ID goes to '(New)', but the fields actually populate data from another record.
This even happens if I set 'Data Entry' to yes for the form.
here's the code behind my button:
Code:
Private Sub btnNewWaste_Click()
DoCmd.GoToRecord , , acNewRec
End Sub
Code:
Private Sub btnDuplicateRecord_Click()
Dim ctrl As Control
For Each ctrl In Me.Form.Controls
If ctrl.Tag = "DefaultMe" Then
ctrl.DefaultValue = """" & ctrl & """"
End If
Next ctrl
blndefault = True
DoCmd.GoToRecord acForm, Me.Name, acNewRec
End Sub
edit: this problem persists in a backup database that only contains one test record. The button pre-populates data that doesn't exist in the back-up database.
Attachments
Last edited: