What does this mean?I try that it doesn't work
What does this mean?
It's showing an error message? Nothing is happening?
With DoCmd
.RunCommand acCmdSelectRecord
.RunCommand acCmdCopy
.GoToRecord , , acNewRec
Me.AllowEdits = True
.SetWarnings False
.RunCommand acCmdPaste
.SetWarnings True
Me.AllowEdits = False
End With
Ah I see what you mean. I didn't actually test the code I gave you before but the logic was right. So I've just tried the below on your database and this works for me:
Code:With DoCmd .RunCommand acCmdSelectRecord .RunCommand acCmdCopy .GoToRecord , , acNewRec Me.AllowEdits = True .SetWarnings False .RunCommand acCmdPaste .SetWarnings True Me.AllowEdits = False End With
Glad we could help.
You want it to copy only certain fields?
Ok, how many fields do you not want to copy? And will this be constant?
Me.NameOfTextbox1.Value = Null
Me.NameOfTextbox2.Value = Null
.
.
.
.
Me.NameOfTextbox20.Value = Null
You can do it two ways after copying and pasting:
1. Delete the value of each control by setting it to Null
OrCode:Me.NameOfTextbox1.Value = Null Me.NameOfTextbox2.Value = Null . . . . Me.NameOfTextbox20.Value = Null
2. Put a text in the Tag property of each control, let's say "_Delete_", loop through each control and if you find the word "_Delete_" in the Tag property, set it to Null.
No! You put that after "Me.AllowEdits = False".
Remember you have to fill in the code for every single field.