[AccessD] Open Query Within Form

Gustav Brock Gustav at cactus.dk
Mon Feb 4 01:02:00 CST 2008


Hi Vlad

I think what most do is to reassign the ControlSource for the TextBoxes (named sequentially) in the (sub)form - DataView or not - to the field names of the recordset from the query, as this:

  intFields = Fields.Count - 1
  For intField = 0 To intFields
    Me.Control("PrefixOfControlName" & CStr(intField)).ControlSource = rst.Fields(intField).Name
  Next

You may need to have the control sources initially to be empty.

/gustav

>>> actebs at actebs.com.au 04-02-2008 05:09:54 >>>
Hi Everyone,
 
Just wondering whether it is possible to open a query within a form? Strange
request I know, but a simple Datasheet form won't work because the field
names for the query are changed programmatically on fly each time the user
changes the criteria. For example he/she might choose data between Jan 2007
to Dec 2007 and I recreate the query on the fly with field names Jan 07, Feb
07, Mar 07 etc etc
 
I hope that makes sense. Any help will be most appreciated.
 
Regards
 
Vlad





More information about the AccessD mailing list