Thanks for the suggestion. Unfortunately,
Dim frm As Form
Set frm = Forms!frmMomsBabies!ctlSubMothers.Form
yields error 2455 at the Set frm line. I've used the dim as subform, etc., with success in referring to controls on subforms before. Somehow, the syntax of "frm.Controls(strCMD)"...
I've had a working function that modified some command buttons on a form. The code read, in part:
Set frm = Forms!frmmomsbabies
strSQL = "SELECT baby_id,baby FROM babies WHERE mom_id = " & mom & " ORDER BY baby"
Set rs = CurrentDb.OpenRecordset(strSQL)
For i = 1 To 5
strCMD = "cmdBaby" &...
I am not sufficiently fluent in vba so I flop around, experimenting with naming conventions to get references to controls correct. I eventually get it right, but this consumes a lot of time. It would be nice to have a function that would return the proper reference for me.
Plus, I've noticed...
The solution: add to form a hidden control set to the existing date (which may be null) when form is opened. Use the calendar to set or change the date. LostFocus event procedure tests whether this date is different from hidden date. If different, perform calculations. Calculation results...
I've tried looking before asking, but my eyes are beginning to lose focus.
frmBabies has a control for birthdate. The birthdate is used to calculate the due dates for a set of follow-up tasks. These tasks appear on a subform that is one of several tabbed pages.
When I use a calendar control...
Solution found. I love abductive logic = wander around aimlessly hoping for luck or inspiration!
I added "rs.requery" in the babies combo box AfterUpdate event immediately after setting rs=Me.RecordsetClone. I just needed the requery in the right place.
gwb
Thanks for the suggestion. I added this to the command on the subform for saving the record. What happened, though, was that the requery cost me references to controls. My code threw an error at a reference to a subform control. Net result was I was further away from my goal!
George
Situation:
I have a form for mothers & babies. There are two combo boxes in the header, one for selecting each. There's also a button for adding a mother. The detail section has two tabs, one for mothers, one for babies. The mothers tab is simply additional fields from the recordset. The...