Hi,
This is fairly easy. Do you want the button to open a form or report? Is your combo box bound to a primary key on the buyer's table? If you can send some structure, we can do this real quick.
You will want your starting form to have a combo box that looks up the buyers in the buyer's table by PK, then displays the buyers' names and code. Is the code the PK? This should be the bound column.
Then you have a button on the form that opens another form or report that displays all the info about the buyer you have selected. Assume it is a report based a either the buyer's table or a qry of the buyers table. For the button's On Click event you would add this code:
'=====
Dim intBuyerCode As Integer 'assuming its an integer
Dim stDocName As String
Dim stLink As String
intBuyerCode = Me.cboYourBuyerComboBoxName
stLink = "[BuyerPK] = " & intBuyerCode
stDocName = "rptYourBuyerReport"
DoCmd.OpenReport, stDocName, acPreview, , stLink
'=====
If it is a form, that would be different, or if the buyer code were a string, that would require this syntax:
'=====
stLink = "[BuyerPK] = " & "'" & stBuyerCode & "'"
HTH,
mmcdonal
|