Edit query by using form

  • Thread starter Thread starter sadat
  • Start date Start date
S

sadat

Hi. I want to edit several conditions of a query by using form. I know that
this can be done using macro in the form. But I do not know how to do it. Can
any one please help me with this? I am stuck here for several days and cant
figure out a solution.

I just have a table with company name, date and share price. What I want to
do is just click in a check box which has the name of the company and select
date from the combo box. This will edit the query in according to the
conditions. and finally clicking on a button will give me the price of a
company's share according to date.

Thanking you in advance,
Sadat Mainuddin
 
Sadat,

If your porpose here is simply to find the Share Price for a given
Company for a given Date, you could do it like this... On your form put
3 unbound controls. Let's say they are named FindCompany, FindDate, and
SharePrice. I imagine that FindCompany may be a combobox, to list all
the available Company names. FindDate may be a textbox - whatever, the
Format property should be set to a valid date/time format (it doesn't
matter which). And then in the Control Source property of the
SharePrice textbox, enter like the equivalent of this:'
=DLookup("[Share Price]","NameOfYourTable","[Company Name]='" &
[FindCompany] & "' And [Date]=#" & [FindDate] & "#")

So then, whenever you enter a company name and date, the associated
share price should be shown automatically.
 
Back
Top