Using custom Form properties in a query

R

Rob

Hi all,

I am experimenting with passing parameters to queries. I have a query
where I need to select information based on two fields. At the moment I am
passing this data to the form via OpenArgs (using a custom routine to
extract information from a variant).

I was investigating whether I could do this instead using custom
properties?

Property Set SelectedMilestone() As Long
SelectedMilestone = lngCurrentMilestone
End Property

And then in the query:

WHERE
(((tblMilestones.mstoneID)=[Forms]![sfrmMilestones].[SelectedMilestone] ...

When set this way, I am presented with an input box asking for
SelectedMilestone.

I know that I could use global variable, but I am trying to avoid them as I
am sure there are more elegant solutions. Any help, comments, advice or
criticism welcomed

Cheers
Rob
 
B

bhicks11 via AccessMonster.com

I have never had occassion to use a custom property but I found a blurb by
Allen Brown about it:

http://www.allenbrowne.com/ser-09.html

Looks like you Dim a variable and give it the value. However, I was
wondering, what is lngCurrentMilestone? If this is a field or value on the
form, just refer to it directly in the parameter.

So the criteria would be forms!whatever.lngCurrentMilestone.

Bonnie
http://www.dataplus-svc.com
Hi all,

I am experimenting with passing parameters to queries. I have a query
where I need to select information based on two fields. At the moment I am
passing this data to the form via OpenArgs (using a custom routine to
extract information from a variant).

I was investigating whether I could do this instead using custom
properties?

Property Set SelectedMilestone() As Long
SelectedMilestone = lngCurrentMilestone
End Property

And then in the query:

WHERE
(((tblMilestones.mstoneID)=[Forms]![sfrmMilestones].[SelectedMilestone] ...

When set this way, I am presented with an input box asking for
SelectedMilestone.

I know that I could use global variable, but I am trying to avoid them as I
am sure there are more elegant solutions. Any help, comments, advice or
criticism welcomed

Cheers
Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top