Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populating Tables from Forms

Status
Not open for further replies.

pmkieffe

Technical User
Jun 12, 2006
32
ID
I have information in three tables which are to be displayed in a form. This form is to be used by another user to select a combination of entries from the three lists and enter a number as well. I would like each of these combinations to be used to populate a seperate table. Is this possible?

Thanks,
pmkieffe
 
You can use recordsets. Let's say you have a save button. Then on the AfterUpdate, you could have something like:
Private Sub Command0_AfterUpdate()
Dim DB As DAO.Database
Dim RS As DAO.Recordset
Set DB = CurrentDb()
Set RS = DB.OpenRecordset("MMCMainTable", dbOpenDynaset)
' strWhere = "[MMCNumber] = " & Chr(34) & Me![MMCNumber] & Chr(34)
' RS.FindFirst strWhere
' If RS.NoMatch Then
' MsgBox "No match found"
' Else
RS.AddNew
RS![tablefieldname] = Me![controlname]
etc.
RS.Update
' End If
RS.Close
DB.Close
Set RS = Nothing
Set DB = Nothing
End Sub

Commented lines are there if you need them.
 
Thank you, but could I accomplish this with a command button and coding the onclick event?

Thanks,
pmkieffe
 
My mistake. I copied code and didn't check it. The save button is a command button and it should be ONCLICK. Sorry.
 
fneily,

thank you for the code help.
i am very new to access, so could you please clarify the values for:

a)MMCMainTable
(is this the table i am populating?)
b)MMCNumber
?
c)tablefieldname
(is this the field in the table i am populating?)
d)controlname
(is this the ID key of the field in the form?)


Thank you for you patience,
pmkieffe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top