Updating table automatically help

G

Guest

I am looking to see if I can update a field, based on conditions from 2 tables.
tblCustomers [CustomerID], [Status]
tblBid [BidID], [CustomerID], [BidDate]

I need to run a DateDiff to find out if between Today and BidDate has been
30 And their Status = "Bid/Estimate"
If that holds true, I want to change the Status to "Follow-Up".

I'm not sure how to run code or even begin putting it together.
I need some advice!
 
G

Guest

Is this to be done in a form as a user enters data or are you looking to do
bulk processing of all the entries in your table?

Daniel



Jeffshex said:
I am looking to see if I can update a field, based on conditions from 2 tables.
tblCustomers [CustomerID], [Status]
tblBid [BidID], [CustomerID], [BidDate]

I need to run a DateDiff to find out if between Today and BidDate has been
30 And their Status = "Bid/Estimate"
If that holds true, I want to change the Status to "Follow-Up".

I'm not sure how to run code or even begin putting it together.
I need some advice!
 
G

Guest

Bulk Processing.

I just did a query that has the customer ID, their BidDate, Status, and a
calculated field between Date() and BidDate. I suppose I could run some code
off of that to update where Status = "Bid/Estimate" and DaysPassed > 30.

Thoughts?
 
J

John Spencer

So, what do you want the status to be if a customer has multiple bids? The
SQL below doesn't care if you have mutliple bids

UPDATE tblCustomers INNER JOIN tblBid
ON tblCustomers.CustomerID = tblBid.CustomerID
SET TblCustomers.Status ="Follow-up"
WHERE tblBid.BidDate <= Date()-30 and
tblCustomers.Status = "Bid/Estimate"

If you already have a query that shows which records you want to update then
all you need to do is open it in design view and select Query: Update Query
from the menu. Then in the update to enter "Follow-Up" and then select
Query: Run from the menu. You can save the changed query to another name if
you desire.


Jeffshex said:
I am looking to see if I can update a field, based on conditions from 2
tables.
tblCustomers [CustomerID], [Status]
tblBid [BidID], [CustomerID], [BidDate]

I need to run a DateDiff to find out if between Today and BidDate has been
30 And their Status = "Bid/Estimate"
If that holds true, I want to change the Status to "Follow-Up".

I'm not sure how to run code or even begin putting it together.
I need some advice!
 

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