What is better ?

  • Thread starter Thread starter Alain
  • Start date Start date
A

Alain

Hi to all,

I would like to know what is the best way to populate an unbound field,
using a domain function or the result of a query ?

If the query is the best way, how do I return the value of the query to an
unbound field, I'm not sure on how to do it ?

Thanks
 
hi Alain,
I would like to know what is the best way to populate an unbound field,
using a domain function or the result of a query ?
This dependes on the actual use case.

How often is this field populated?
Is it on a unbound form?
Is this form a stand-alone form or is it a subform or does it contains
subforms?
Is there any relation to the data?
Why don't you use a bound field?
If the query is the best way, how do I return the value of the query to an
unbound field, I'm not sure on how to do it ?

Dim rs As DAO.Recordset

Set rs = CurrentDb.OpenRecordset( _
"SELECT fieldList FROM tableOrQuery", dbOpenSnapshot)
txtUnbound.Value = rs![fieldName]
rs.Close
Set rs = Nothing


mfG
--> stefan <--
 
Hi Stefan

Stefan Hoffmann said:
hi Alain,

This dependes on the actual use case.

How often is this field populated?
I have a main form on which there is a tab control, on those tabs, there is
approx 6 to 8 small forms and subforms
Is it on a unbound form?
the form itself is bound to the main form
Is this form a stand-alone form or is it a subform or does it contains
subforms?
it could be a mix of everything
Is there any relation to the data? yes
Why don't you use a bound field?
most of it is to get totals of already populated fields, most of them are
based on specific criteria, if I use regular query, I will end up with a
multitude of mini subforms for no reason.
Also some of those fields are hard coded calc
If the query is the best way, how do I return the value of the query to an
unbound field, I'm not sure on how to do it ?

Dim rs As DAO.Recordset

Set rs = CurrentDb.OpenRecordset( _
"SELECT fieldList FROM tableOrQuery", dbOpenSnapshot)
txtUnbound.Value = rs![fieldName]
rs.Close
Set rs = Nothing


mfG
--> stefan <--
.
 
Back
Top