Reference a field on a sub form

Papa_Bear_1352

New member
Local time
Today, 13:28
Joined
Jun 16, 2003
Messages
9
Reference a field on a sub form (Resolved. Thank You)

Hi All

I am trying to reference a field on a sub form from a button on the main form. I want to read a field called "Date1" and I want Date1 from the first row, regardless of which row has been selected by the user. The statment used is

FrmGroupSubform.Form!TxtDate1.

Any ideas PLEASE

Steve
 
Last edited:
If your [Date1] field is bound to the TxtDate1 control and the SubFormControl is named FrmGroupSubform, then the syntax you have *will* work. Remember, forms are displayed on other form by means of a SubFormControl, whos name is *probably* the same as the form it displays, but it is not a requirement. Unfortunately you will *always* get the value from the Current record, which is the last record selected by the user in the SubForm. There are other means to get the 1st record but why do you need this record's data?
 
Hi RG
Initialy, the 50 records on the subform each with 4 date fields will be null. I want the user to enter the first date and the code will generate dates in the other 149 fields according to certain rules. The code will not work if any of the other records are selected. These dates can then be manually amended to take into account bank holidays etc and then used to generate next years bookings. These records are only used as a work file. I will probably do a dlookup or write code to make sure I get the first record. I am already reading through the record set to write the other dates. Just wondered if there was an easier way.
 

Users who are viewing this thread

Back
Top Bottom