Selection on combo box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to create a form that when opened has a combo box at top, in this
combo box are a list of choices of cardiovascular training programmes that my
trainers can choose from and complete bespoke details for their clients. At
the moment i have 1 form with all the programmes on it and looks very
confusing so would prefer to just have it to open on the combo box choice of
options. I ma not a programmer but have beg to int knowledge of access. Any
help would be appreciated.

Paul
 
Assuming you've already got a blank record at this point (so you're not
changing existing details - if not, you want to include a go to new record in
there.), something like this in the AFTER_UPDATE of the relevant combo box
ought to do it

Note I've assumed the relevant table is called Tbl_Courses and that this
also is used to populate the combo box (and the combo is limited to list).

Private Sub ComboTraining_AfterUpdate()
Dim db As DAO.Database, rst As DAO.Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("Tbl_Courses", dbOpenDynaset)
rst.FindFirst "CourseID = " & Me!ComboTraining

If rst.NoMatch Then
'assuming the combo box is populated from the Tbl_Courses table, then
this shouldn't happen
rst.Close
GoTo ExitSub
Else
'change these to match your own particular requirements
Me!CourseDescription = rst!CourseDescription
Me!CourseFees = rst!CourseFees
Me!CoursePrerequisites = rst!CoursePrerequisites
rst.Close
End If

ExitSub:
Exit Sub

End Sub
 
Back
Top