moving data between subforms?

PARSO

Registered User.
Local time
Today, 08:14
Joined
Dec 13, 2004
Messages
66
ok this is the problem

i have 1 main form, with two subforms displayed on it i want to move data from sub form a to sub form b. while at the same time clearing all data from each text box in sub form a, so up to date data can be added to sub form a

any help appreciated

thanxs
 
Private Sub Command0_Click()
'MsgBox Me!Subform1.Form!ControlName
MsgBox Me!Table1subform.Form!ID


Dim myID As Integer, SQL1 As String, Sql2 As String

myID = Me!Table1subform.Form!ID


SQL1 = " INSERT INTO Table2 ( Table2Field1, Table2Field2 ) SELECT Table1.Table1Field1, Table1.Table1Field2 FROM Table1 WHERE Table1.ID= " & myID

Sql2 = " DELETE Table1.ID FROM Table1 WHERE Table1.ID=" & myID


DoCmd.SetWarnings False
DoCmd.RunSQL (SQL1)
DoCmd.RunSQL (Sql2)
DoCmd.SetWarnings True

Me!Table1subform.Form.Requery
Me!Table2subform.Form.Requery

Me.Form.Refresh
End Sub
 

Attachments

thank you very much!!
exactly what i was after :)
 

Users who are viewing this thread

Back
Top Bottom