A button to send some data from an active form to another table (1 Viewer)

grae.uk

Access Noob!
Local time
Today, 21:12
Joined
Oct 13, 2008
Messages
9
Hi guys,

I have a database that I am working on where I want to create a button on the form that will take 5 of the fields on that form and enter them into another table that is storing a few pieces of the same data but working with another part of the system....and then open the form with the info we just sent so we can finish adding stuff...

I am probably going to get told of for not normalising this db properly ;-) .. but actually it is two systems we are joining together and for now this is fine until we redeveop completely and it is currently holding fairly limited amount of data... :)

thanks in advanced for any suggestions .. I am guessing it is fairly easy .. but don't even know where to begin as PHP is my natural language for programmin in :)

Thanks,

Graham,
 

JANR

Registered User.
Local time
Today, 22:12
Joined
Jan 21, 2009
Messages
1,623
You can either run an Append query or open a recordset agains your table using code.

ex:
Code:
Private Sub SendData()
Dim rs As DAO.Recordset
Set rs = Currentdb.OpenRecordset("MyOtherTable", dbOpenDynaset)
With rs
   .AddNew
   !TableField1 = Me.FormControl1
   !TableField2 = Me.FormControl2
   ... etc
   .Update
   .Close
End With
Set rs = Nothing
End Sub

You can call this sub from the click event of your button after you have validate the entry.

Code:
Private Sub MyButton_Click()
...Some validation code perhaps??
SendData
End Sub

JR
 

grae.uk

Access Noob!
Local time
Today, 21:12
Joined
Oct 13, 2008
Messages
9
awesome thanks, got it working with that! Much appreciated :)

G
 

Users who are viewing this thread

Top Bottom