Replicate 2 fields (1 Viewer)

access2010

Registered User.
Local time
Today, 00:36
Joined
Dec 26, 2009
Messages
1,021
Could I please receive assistance on how, when we click the Replicate Button on the Data Base Form copy and replace any data into the two fields as below?

Copy from WebDate to WebDate_Previous
Copy from Advice to Advice_Previous

Could the click of the Replicate Button, place To-Day’s Date into the WebDate field?

The DataBase that we are using is MsAccess 2003

Thank you for your suggestions

Crystal
 

Attachments

  • Replicate_2_Fields.mdb
    576 KB · Views: 63

essaytee

Need a good one-liner.
Local time
Today, 17:36
Joined
Oct 20, 2008
Messages
512
Could I please receive assistance on how, when we click the Replicate Button on the Data Base Form copy and replace any data into the two fields as below?

Copy from WebDate to WebDate_Previous
Copy from Advice to Advice_Previous

Could the click of the Replicate Button, place To-Day’s Date into the WebDate field?

The DataBase that we are using is MsAccess 2003

Thank you for your suggestions

Crystal
Try this:
Code:
Private Sub Replicator_Click()
    Me.WebDate_Previous = Me.WebDate
End Sub
 

access2010

Registered User.
Local time
Today, 00:36
Joined
Dec 26, 2009
Messages
1,021
98% = essaytee

Thank you for your suggestion which WORKS on the main form, but is not copying the Advice Field Data in the SubForm.
===
Private Sub Replicator_Click()
' == Button Name
Dim lngCurrent As Long
Dim rs As DAO.Recordset
On Error GoTo ErrHandler
Set rs = Me.RecordsetClone
lngCurrent = Me.CurrentRecord
rs.MoveFirst
rs.Move lngCurrent - 2
Me.WebDate_Previous = Me.WebDate
' == Copy to [WebDate_Previous] From [WebDate] and Overwrite Any Data == Main Form
Me.Advice_Previous = Me.Advice
' == Copy to [Advice_Previous] From [Advice] and Overwrite Any Data == Sub Form
ErrHandler:
rs.Close
Set rs = Nothing
End Sub

===
Can you please offer a suggestion on how to copy the data on the Sub Form?
Thank you
Nicole
 

essaytee

Need a good one-liner.
Local time
Today, 17:36
Joined
Oct 20, 2008
Messages
512
Create an Update Query as follows:
Code:
UPDATE Investments01_tbl_SubForm SET Investments01_tbl_SubForm.Advice_Previous = [Investments01_tbl_SubForm].[Advice]
WHERE (((Investments01_tbl_SubForm.Symbol_Stock)=[Forms]![Investments_StockBrowse_WebLinks_F]![Symbol_Stock]));
I named it qry_UpdateAdvice

The click event in full is as follows:
Code:
Private Sub Replicator_Click()
    If Not Me.NewRecord Then
        Me.WebDate_Previous = Me.WebDate
        Me.WebDate = Date
        
        If Not IsNull(Me.Symbol_Stock) Then
            DoCmd.OpenQuery "qry_UpdateAdvice"
        End If
    Else
        MsgBox "Can not perform this function, we are at a New Record"
    End If
End Sub
 

Users who are viewing this thread

Top Bottom