Query Question

M

Marco

Hi
I have a Query using a drop-down list. This query opens up as a form. I
then have a command button that has a update query that on click
changes all the records loaded to todays date. Why is it changing all
the records in the table and not just the records displayed. I will
give more detail.

I have a client list... I need to filter it down to client by city. I
have a field for "Last Time Marketed by Email". The Update query is to
only update the current records in the form.

Can anyone help?

Marco
www.classactinsurance.com
 
F

fredg

Hi
I have a Query using a drop-down list. This query opens up as a form. I
then have a command button that has a update query that on click
changes all the records loaded to todays date. Why is it changing all
the records in the table and not just the records displayed. I will
give more detail.

I have a client list... I need to filter it down to client by city. I
have a field for "Last Time Marketed by Email". The Update query is to
only update the current records in the form.

Can anyone help?

Marco
www.classactinsurance.com

Not if you don't post the Update query SQL.
 
F

fredg

Sorry about that.. I am new to access

UPDATE ProspectingList SET ProspectingList.DateEmail = Date()
WHERE
(((ProspectingList.PTypeOfBusiness)=[forms]![ProspectingListSearch]![PTypeOfBusiness]));

Please always include the relevant portion of any precious post so
that everyone reading this message will have a reference as to what it
is you are talking about without having to search through your
previous messages.
To be helpful, I've copied your previous message here:

****
Hi
I have a Query using a drop-down list. This query opens up as a form.
I then have a command button that has a update query that on click
changes all the records loaded to today's date. Why is it changing all
the records in the table and not just the records displayed. I will
give more detail.

I have a client list... I need to filter it down to client by city. I
have a field for "Last Time Marketed by Email". The Update query is to
only update the current records in the form.

Can anyone help?

Marco
www.classactinsurance.com

****
1) Queries don't have drop-down lists. Queries have fields.
You can use a Drop-down list on a form to filter the query field by
referring to this drop-down list in the query using
forms!formName!ControlName.

2) Queries can't open up as a form. They are always in Datasheet view.
However, you can create a form that has a query as it's record source.
When you open the form, the results of the query are displayed in the
form.

3) Command button's don't have Update queries. They have events which
can be used to open (run) an Update query.

4) I have no idea which records you are showing in the form. Do they
all have the same [PTypeOfBusiness] value?

5) As written, your update query will update all the records in the
ProspectingList table that have the SAME [PTypeOfBusiness] field value
as the record that is the CURRENT RECORD on the form.

6) I get the feeling here that your problem is not in the query, but
how you are going about selecting the records to update. See my
response to you in a different thread.
 

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