How do I add a Calculated field in a sub form that works for each record (1 Viewer)

t00ley

Registered User.
Local time
Today, 17:31
Joined
Jul 5, 2011
Messages
18
Hi All,

I have 'custom query builder' in a main (Header) & sub form (Criteria), where the user selects a field name (combo) from a table, operator (combo), & value (textbox).

I also have a function to return the TableDef DataTypeName of the Field name selected, which works as expect for a single sub form record (and for all table fields, tested by a sub procedure via a loop).

I've added a textbox in the subform which calls the function, however instead of returning the correct DataTypeName for the field name of each record in the subform, it repeats the DataTypeName of the first record for all subsequent records.

I've also tried to work around by adding a calculated field to the table itself, but it won't accept the function (I understand only limited functions are available).

FYI I'm using the DataTypeName to then limit the available operators in the combobox and to determine whether text identifiers are needed when building the query in SQL.

Any idea's how I can achieve this?

Thanks

Tooley
 
Last edited:

Minty

AWF VIP
Local time
Today, 17:31
Joined
Jul 26, 2013
Messages
10,355
Put the function in the sub-form recordsource (query) not the form.
 

t00ley

Registered User.
Local time
Today, 17:31
Joined
Jul 5, 2011
Messages
18
It's obvious now you've said that, thanks :)
 

Users who are viewing this thread

Top Bottom