currently, i have a form where a user can manipulate data. however, because i only want them to change "Supplier" of a product to a known one, i have created a second form. which they click (next to the supplier entry field.) this displays a list box ( with supplier id as an index). i have got it so that when someone lciks on an entry in the list box, the supplier is changed. however, my way of doing it seems ineeficient. here is the basics:

form1 : finds data relating to a product, searches the supplier table for the supplier name to display
open form 2>click supplier> click ok
form1 gets id from form2 and searches supplier table for name> displays name

is there a more efficent way of coding this?

also,
i have 2 ideas for storing invoices

1) invoice# = primary key, all products listed in a text box, csv
2)primary key= auto number. single database entry made for every product sold (invoice# also repeated)

which one of these would be the best to use?
or are there better ways?

Hmmm sounds hard :confused:

Good Luck :rolleyes:

You could use a combobox.... for the supplier list instead of a textbox... make it drop down only, or you could leave it so they can type in it, but do a select case, or an if statement and make sure it's a valid supplier.

i have created a drop down combo box that displays the supplierName and holds supplier_id

(tested with

private cbpSUpplier_click()
 txtSupplier = CStr(cboSupplier.ItemData(cboSupplier.ListIndex))
end sub

)

code for populating the combo box:

Do While Not RP.EOF
    cboSupplier.AddItem RP.Fields("SupplierName").Value
    cboSupplier.ItemData(cboSupplier.ListCount - 1) = CLng(RP.Fields("Supplier_ID").Value)
    RP.MoveNext
    Loop

however, i dont know how to get the combo box default value to display using the index and RS!supplier_ID from another table.

what i need is to get RS!supplier_ID to be found on the combo box, with that value automatically selected. any ideas?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.