Button to save as new record + duplicate fields

mklitwin

Registered User.
Local time
Today, 15:02
Joined
Sep 29, 2010
Messages
30
Ok so, since you guys know everything it seems, im looking for a few things here

First - i have a calculated field in a query which is the combination of entity name and date. it works great as an identifier for us since we can see when this entity's details are from. (and we want to keep the history). What i need is a button that will allow me to go to that record, edit the information and save it as a NEW record with a NEW date... clearly editing the information and clicking the ordinary save button will overwrite that record.

On the same token, is there a way to prevent or make a popup in which lets say we enter the same entity with the same date 2x it does not permit that duplicate c ombination in the record ID (now keep in mind this isnt the primary key - thogugh techinclally it could be but i was getting in trouble when i was tryign to "duplicate record and save the changes", thus why that button would be extremely helpful to avoid the duplicate record issue.
 
Ok so, since you guys know everything it seems, im looking for a few things here

First - i have a calculated field in a query which is the combination of entity name and date. it works great as an identifier for us since we can see when this entity's details are from. (and we want to keep the history). What i need is a button that will allow me to go to that record, edit the information and save it as a NEW record with a NEW date... clearly editing the information and clicking the ordinary save button will overwrite that record.

On the same token, is there a way to prevent or make a popup in which lets say we enter the same entity with the same date 2x it does not permit that duplicate c ombination in the record ID (now keep in mind this isnt the primary key - thogugh techinclally it could be but i was getting in trouble when i was tryign to "duplicate record and save the changes", thus why that button would be extremely helpful to avoid the duplicate record issue.


The code here is something I use to duplicate a record, you can always add the option to change the date field. I have added in red the fieldname you would have to change.

Private Sub Command50_Click()
On Error GoTo Err_Command50_Click

DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
DoCmd.RunCommand acCmdRecordsGoToNew
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdPaste
me.txtDate.value=Date
Exit_Command50_Click:
Exit Sub
Err_Command50_Click:
MsgBox Err.Description
Resume Exit_Command50_Click

End Sub
 

Users who are viewing this thread

Back
Top Bottom