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

2 tables, 1 combo box, 1 form, no solution?!?!?!?!?!?!?!

Status
Not open for further replies.
Jan 27, 2003
35
GB
I have 2 tables linked by a 1 to many relationship
via personID and PersonNo

PersonID 1-------M PersonNo

1 person may have many injuries.......

Form:
name=phys

Tables:
1st PeronInfo
2nd Injuries

Form record source:
Injuries

Combo Boxes:
no.1 Based on PersonInfo
using PersonID,FirstName,LastName
(personID is stored in a textbox (PersonNo) from record source)

no.2 Based on Injuries and uses playerNO stored in the text box and the date of the injury. this locates a record and its values are located using this bit of SQL so the user can search injuries by date.

SELECT injury.InjNo, injury.PlayerNo, injury.Date
FROM injury
WHERE (((injury.PlayerNo)=[forms]![phys]![PlayerNo]));

how do i use the first combo box to select a record? it currently edits a record by changing the PersonNo the injury occured to.

Acording to the help files i need to write a query and i do not know where to start..........

HELP!?!?!?!?!?!
 
You have to use an unbound combo box somewhere in the form header or footer.
Then use this code for the AfterUpdate event:

Sub ComboName_AfterUpdate()

With Me.RecordsetClone
.FindFirst "PlayerNo = " & Nz(Me("ComboName"),0)
If .NoMatch Then
Exit Sub
Else
Me.Bookmark = .Bookmark
End If
End With

End Sub

Bound combo boxes write to records when changed

Good luck
[pipe]
Daniel Vlas
Systems Consultant
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top