Can't "duplicate" I can "add" same info. Please help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that I have a "duplicate" buttons setup. It is based off of a
query. When I use the button, I get the can't have "null value" error. I
can however add a new record with the same info and that field left blank and
it works fine. Just not with the duplicate button.
 
I have a form that I have a "duplicate" buttons setup. It is based off of a
query. When I use the button, I get the can't have "null value" error. I
can however add a new record with the same info and that field left blank and
it works fine. Just not with the duplicate button.

Then there's something wrong with either your query or your code. Care
to post them so we can help figure out what that might be?

John W. Vinson[MVP]
 
I really don't know what I'm looking for. Any help would be greatly
appreciated.


Private Sub Duplicate_Record_Click()
On Error GoTo Err_Duplicate_Record_Click


DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append

Exit_Duplicate_Record_Click:
Exit Sub

Err_Duplicate_Record_Click:
MsgBox Err.Description
Resume Exit_Duplicate_Record_Click
 
I really don't know what I'm looking for. Any help would be greatly
appreciated.


Private Sub Duplicate_Record_Click()
On Error GoTo Err_Duplicate_Record_Click


DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append

Exit_Duplicate_Record_Click:
Exit Sub

Err_Duplicate_Record_Click:
MsgBox Err.Description
Resume Exit_Duplicate_Record_Click

Well, this is old ugly obsolete wizard code - why Microsoft hasn't
updated it is beyond my comprehension.

What's the Recordsource of the form? Is it a Table, or a query? Are
there required fields in the table? What exactly are you trying to
accomplish (storing an exact duplicate of a record is essentially
never a good idea)?

John W. Vinson[MVP]
 
Back
Top