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

Add new records to table from form

Status
Not open for further replies.

DaveCrate

Technical User
Jan 12, 2004
41
US
New to forms and VB
Access2000

I have a form with a listbox containing 4 columns and 5 different suppliers from SupplierTable(SELECT SupplierTable.VendorID, SupplierTable.Supplier, SupplierTable.Vendor, SupplierTable.PO FROM SupplierTable;
............................................................

Form Button:
Private Sub Button_New_Request_Click()
On Error GoTo Err_cmdqryAppendSupplierRequest

Dim stDocName As String

stDocName = "qryAppendSupplierRequest"
DoCmd.SetWarnings False
DoCmd.OpenQuery stDocName, acViewNormal, acEdit
DoCmd.SetWarnings True

Exit_cmdqryAppendSupplierRequest:
Exit Sub

Err_cmdqryAppendSupplierRequest:
MsgBox Err.Description
Resume Exit_cmdqryAppendSupplierRequest
End Sub
............................................................

I want to select a supplier and INSERT into NewRequestTable
with a append query:
(INSERT INTO NewRequesttable ( SUPPLIER, VENDOR, PO )
SELECT SupplierTable.Supplier AS Expr1, SupplierTable.Vendor AS Expr2, SupplierTable.PO AS Expr3
FROM SupplierTable;)
............................................................

How do I insert the selection from the listbox to the NewRequestTable table? I want to eventually be able to enter a quantity(i.e. 5) in a txtbox for a supplier and update the NewRequestTable with 5 entries.

Currently NewRequestTable is inserted with the entire listbox

These forums are a great source of knowledge and ideas
Thank you for your help!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top