Hei,
I have a custom designed calendar (main form: CalendarSchedule) which is made up of 37 (to account for changes in what weekday the first day of the month starts...) small subforms (sub forms: CalendarSchedule_dates). The subforms are named SF1, SF2, ..(up to SF37) as they are copied into the main form.
The calendar is used for keeping track of a number of training courses and which days they are taught. A routine sweeps through the calendar, placing information about courses for each day into the corresponding subforms. The original subform has eight fields - four txtCourseDescription (-4), which may contain text related to a specific course (i.e. my calendar handles up to four different courses pr day). In addition, I have four corresponding fields (not visible) to store the courseID. The courseID is needed as reference, in order to be able to open a separate form with all relevant information about that specific course (opens on double click).
Being in the main form, my main struggle is to code the part that retrieves the courseID from a given subform (e.g. "SF11", from one of the four possible courses, courseID1 (-4). This must be coded as an event procedure (dblClick) in the original subform ("CalendarSchedule_dates")
, on each of the four txtCourseDescription1 (-4) fields. Note that the subform may contain information about up to four different courses on the same day.
My own logical approach includes the following:
' first determine which of the subforms is double clicked on
Dim SFnum as Integer
SFnum = ... don't know how to do this...
' retrieve the courseID value from the subform found above
Dim cID as String
cID = Me.Controls("SF" & SFnum).Form.courseID1 .... THIS IS THE PART WHERE I NEED THE MOST HELP..
.. I have a feeling it should contain stuff like "Me.Parent...." or something
' use the cID to open the new form, containing data about the chosen course
stDocName = "frmCourseInformation"
StLinkCriteria = "[courseID]=" & "'" & cID & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria ... (this part should be ok when I get that far...)
Help and suggestions is deeply appreciated :-)
Start Free Trial