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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a record from a combo box. 1

Status
Not open for further replies.

Seekertoo

Technical User
Apr 18, 2001
4
0
0
US
I have a form on which there are 10 items that must be keyed-in and 1 combo box consisting of 5 items. If I select 1 of the 5 items from the combo box, how can I make that 1 item into a record that exists with the 10 items that were key-in?
Using Access 2000 and thank you for your reply.
 
I use a "Save Record" Button but you could probably trigger it on any event. here is a sample of the code I used.

' prompt for confirmation
Dim Msg, Style, Title, Response
Msg = "Save and Close Record Now?" ' Define message.
Style = vbYesNo + vbQuestion + vbDefaultButton1 ' Define buttons.
Title = "SAVE RECORD?" ' Define title.

' Display message.
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then
' Save all values on form

Dim db As Database
Dim rs As Recordset

Set db = CurrentDb
Set rs = db.OpenRecordset("tablename", DB_OPEN_DYNASET)

rs.AddNew
rs!field1 = Me!control1
rs!field2 = Me!control2
rs!field3 = Me!control3
rs!field4 = Date
rs.Update
End If

Hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top