Problem with filling form using query?

S

Smoki

Hi,
I have form based on query. I want to choose value in one field on form, and
then the other fields on form to fill with appropriate values (one row from
table). I made query, I tried it, and it works.
But when i choose one value in that field, and then press command button to
refresh form, nothing happend - the other fields on form don'r fill?! Why???
Maybe my problem is not in query - it works, probably with my form?! But,
how to fix it?

Thanks,
Smoki
 
G

golfinray

If you are using a parameter query, it should just ask you what you want and
then query based on that. If not, you need some code. Put a combo box on your
form. Allow the wizard to do that for you and allow it to set up what ever
you want to search on. Then go into the properties of the combo, go to
events, select the afterupdate event, then click on the little button out to
the right. Start the code builder and type:
Me.filter = "[yourfieldyouwanttolookup] = """ & Me.Combo# & """"
Me.filteron = true

The combo # will be listed, like combo10 or combo22
 
S

Smoki

Dear Milton,
I have done this procedure with combo box, it works.
My problem is something else. Actually, I have form with combo box, and when
I choose something in combo, i read parameters from one row in db. Then I
want to change one parameter. But, this parameter is from another table, and
when I change it, I don't change it only in this one row in my primary table,
then I change it in those another table, so I change it on all places where
it appears :(
Is there any code in VB, how to change it only in one row?

Smoki

golfinray said:
If you are using a parameter query, it should just ask you what you want and
then query based on that. If not, you need some code. Put a combo box on your
form. Allow the wizard to do that for you and allow it to set up what ever
you want to search on. Then go into the properties of the combo, go to
events, select the afterupdate event, then click on the little button out to
the right. Start the code builder and type:
Me.filter = "[yourfieldyouwanttolookup] = """ & Me.Combo# & """"
Me.filteron = true

The combo # will be listed, like combo10 or combo22
--
Milton Purdy
ACCESS
State of Arkansas


Smoki said:
Hi,
I have form based on query. I want to choose value in one field on form, and
then the other fields on form to fill with appropriate values (one row from
table). I made query, I tried it, and it works.
But when i choose one value in that field, and then press command button to
refresh form, nothing happend - the other fields on form don'r fill?! Why???
Maybe my problem is not in query - it works, probably with my form?! But,
how to fix it?

Thanks,
Smoki
 

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