This is an e-mail I got from another user!! Does this mean anything to you and if so, how do I do it?
prodcontrol
Hi again!
Finding the correct record (I'm assuming you've altered the record source of the forms to now be the new "main" table?)
That's a little bit tricky with a composite primary key, but doable. Usual way is to create a combobox with a rowsource containing the primary key (here all three fields in being the primary key) and sufficiant other information for the user to identify the correct part.
First - use the combobox wizard to create such. In the first step of the wizard, select the "Find a recorord on..." (third alternative), then select the fields needed to identify the record (ensure the primary key fields are the first three fields)...
Don't know how much coding you know, but in the property of the combobox, you'll find the event tab, and there there's supposed to be an event procedure on the after update of the combo. Enter the code by first placing the cursor in that line and then pressing the button with three dot's to the right of that line.
There the code, after some tweaking, should look perhaps something like this:
Private Sub ComboN_AfterUpdate()
dim rs as object
set rs=me.recordsetclone
rs.findfirst "[A/C] =" & Me!ComboN & _
" [Card] =" & Me!ComboN.Column(1) & _
" [Part Number] = " & Me!ComboN.Column(2)
if not rs.eof then me.bookmark=rs.bookmark
set rs=nothing
Coupla notes here:
* the primary key field must be in the recordsource of the form (don't have to be present as controls on the form)
* this example assumes all the fields are numeric, if not, text qualifiers are needed (')
* the rowsource of the combo - a/c must be the first field, then card, then part number, cause of the assigning
* i might have misspelt the field names, they probably need correcting
Example if datatype is text:
" [Part Number] = '" & Me!ComboN.Column(2) & "'"