update table

mfuada

Registered User.
Local time
Today, 21:44
Joined
Feb 4, 2009
Messages
63
Hi
right now i have a table that has these fields:
No;series;payment_date;price
the problem is when a user input the data for the first time on a form,the payment_date is automatically generated by a function based on a certain date that the user wanted to, and if a series has the payment_date of 20/02/08, and supposed today is 25/02/08, the payment_date should has also change...i can do that manually by updating the payment_date in a form, but what if i have a hundred payment_date datas that need to be updated...
so could you give me any suggestion...
thanks..
 
could u give me any example of how update query being used?
 
Here's my favorite way to execute an UPDATE query. I use the @-sign wherever I want to insert a value.

Dim qDEf As DAo.QueryDef
Set qDEf = CurrentDb.CreateQueryDef("")
qDEf.SQL = "UPDATE Customers SET FirstName = @FirstName, LastName = @LastName WHERE CustomerID = @CustomerID"
qDEf.Parameters("@FirstName").Value = "John"
qDEf.Parameters("@LastName").Value = "Hopkins"
qDEf.Parameters("@CustomerID").Value = 1
qDEf.Execute

In your case it might something like this:

qDEf.SQL = "UPDATE table1 SET Payment_Date = @PaymentDate WHERE Series = @Series"
 
I hope this is clear. When the query runs, the engine will replace the @-names with the specified values, basically the result is this:

UPDATE Customers SET Firstname = 'John', LastName = 'Smith' WHERE CustomerID = 1
 
ok thx a alot.. i'll try it.. i'll let you know the result.... :)
 

Users who are viewing this thread

Back
Top Bottom