Design of subforms

AmyLynnHill

Registered User.
Local time
Today, 01:22
Joined
Dec 7, 2005
Messages
81
I'm building a db and have questions on the approach/designs.
I have a form, user inputs a SSN, it runs a query that returns several lines of information. I want to be able to select ONE record, have it write to a table named "groups" that is a sub form. Any suggestions on how to select the one record and have it write to a table? The information is being querried against lined tables to an outside SQL db.
 
Well u can create a button and add the following code to it:

Private SUb btnAdd_Click
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset("Groups", dbOpenDynaset)
rs.AddNew

'list all the fields of your table that u want to be added to, on the left and the textboxes, cboboxes, etc, which contain the data u want to add on the right

!Item1 = Me.Item1
!Item2 = Me.Item2
'and so on...

rs.Update
rs.Close
End Sub

With the form running, put your cursor somewhere in the record you want to add fields from, and click the button. This will cause the code to place the data selected from this record (Me.item1,...) in the corresponding field of the table (!item1...)

HTH
 

Users who are viewing this thread

Back
Top Bottom