Re: Reference form control for a query

Tech-Archive recommends: Fix windows errors by optimizing your registry



Thanks Douglas
It worked.

Douglas J. Steele wrote:
Write a function that returns the value you need, and refer to the function,
not the control.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


<hamidrjafari@xxxxxxxxx> wrote in message
news:1160664247.422910.31890@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi

I know it is easy to reference value of a control on a form in a query.
For example we could use this expression in the WHERE clause of a
simple SQL SELECT query:
[forms]![myLoadedForm]![control]

But i have a problem. It only works for simple 'native' controls such
as textboxes, comboboxes, etc and not for complex ones such as
treeviews and listviews. Actually the thing I want to reference is the
selected item in the treeview and I have used a veriaty of formats:
[forms]![myLoadedForm]![tvw].selectedItem
[forms]![myLoadedForm]![objTvw].selectedItem -- that I had in the
form's load event: set objTvw = tvw.object
...

What should I do?
And also why it is needed to have such statement : set objTvw =
tvw.object?
thnx
hamid


.



Relevant Pages

  • Re: how to place the cursor in the field of a subform
    ... Open form and set cursor to PayDate ... the control on the subform on the tab control. ... Doug Steele, Microsoft Access MVP ... Private Sub PayDate_Enter ...
    (microsoft.public.access.formscoding)
  • Re: access control name from the sub
    ... Doug Steele, Microsoft Access MVP ... I have name conversion all the spin button have prefix spb and text boxes ... You don't need to know the name of the control. ...
    (microsoft.public.access.formscoding)
  • Re: object required error
    ... Doug Steele, Microsoft Access MVP ... (no e-mails, please!) ... rather than a control for the sort key fieldname. ...
    (microsoft.public.access.formscoding)
  • Re: How do I stop rounding of my calculation results.
    ... You show a calculation, but not how that calculation is assigned to the ... Doug Steele, Microsoft Access MVP ... (no e-mails, please!) ... If the amount is less that 0.51 my control is rounding down to 0. ...
    (microsoft.public.access.forms)
  • Re: Bound many controls to a "frame" in a form
    ... Doug Steele, Microsoft Access MVP ... (no private e-mails, please) ... Dim ctlCurr As Control ...
    (microsoft.public.access.forms)