Form Help (1 Viewer)

TimjHebert

Registered User.
Local time
Yesterday, 18:21
Joined
Dec 12, 2004
Messages
40
I have a database with several tables and relationships are set. Example

tblcustomer
tblradio

i also have a history tables setup

historycustomer
historyradio

i would like a button on my form to perform an append query to the history tables and then delete the records in the active tables. how can i do this

Thanks in advance!
Tim
 

Steve5

Registered User.
Local time
Yesterday, 16:21
Joined
Apr 23, 2003
Messages
41
1. Make sure your History Table Scheme's are the same
2. Create a Append Query to linked from the Main tables and appending to the History tables.
3. If you are using VB can do write a code linked to the button on the form that would look something like this. {title your button "Command2" if you use the below code}

Private Sub Command2_Click()
On Error GoTo Command2_Exit

If (MsgBox("Update History Tables", 1) = 1) Then

DoCmd.SetWarnings False

'----------- Create the Append querys to take from your main tables and apply to the History tables
DoCmd.OpenQuery "Q_APPEND_customer", acViewNormal, acEdit
DoCmd.OpenQuery "Q_APPEND_radio", acViewNormal, acEdit

'-----------Deletes all data in main tables
DoCmd.OpenTable "tblcustomer", acViewNormal, acEdit
DoCmd.RunCommand acCmdSelectAllRecords
DoCmd.RunCommand acCmdDelete
DoCmd.Close acTable, "tblcustomer"

DoCmd.OpenTable "tblradio", acViewNormal, acEdit
DoCmd.RunCommand acCmdSelectAllRecords
DoCmd.RunCommand acCmdDelete
DoCmd.Close acTable, "tblradio"
DoCmd.SetWarnings True


Beep
MsgBox " Update Completed", vbInformation, ""


Else
Exit Sub
End If


Command2_Exit:
Exit Sub

Command2_Err:
MsgBox Error$
Resume Command2_Exit

End Sub
 

TimjHebert

Registered User.
Local time
Yesterday, 18:21
Joined
Dec 12, 2004
Messages
40
Form Help!!!!

Thanks for the information Steve!
Will this work on one record at a time, that is what i want.
 

Users who are viewing this thread

Top Bottom