Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 MS Access Date Updation issue

Author  Topic 

gagan
Starting Member

5 Posts

Posted - 2003-08-01 : 14:50:16
Hi!,
I am new to MS Access, i have to update a date column in table

table_r

ar_date date/time , defined as (general date)

The Update queri i have written is

Date ld_date_var

Update table_r set ar_date = ld_date_var;
comit;

If my date variable has a date which i pick from a edit mask
with a mask of yyyy-mm-dd


Please, any help would be apperciated,
Thanx,
gagan

X002548
Not Just a Number

15586 Posts

Posted - 2003-08-01 : 15:55:50
How are you doing this? From a From, Query, Code?

Are you accessing SQL Server or Access tables?

What is the reason behind the update?



Brett

8-)

SELECT POST=NewId()
Go to Top of Page

gagan
Starting Member

5 Posts

Posted - 2003-08-01 : 16:07:24
I am using powerbuilder front end and the backend is ms access database on my computer,
usuall i work with Oracle where the regular update ststement can be embeded in the code and it works,
like in Powerbuilder i write

example
update table set date = to_date(date_variable,"mm-dd-yy");
it works,
but i am facing a lot of issues with Updating a date in MS access table.

I can select fine from the table

The reason for the update is to update column( ar_date) in a row in the table based on a where clause

Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2003-08-01 : 16:18:52
TO_DATE is an Oracle function..Access is way more lose

Try

UPDATE Table1 SET col1 = '01-01-01';



Brett

8-)

SELECT POST=NewId()
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-08-01 : 16:44:17
Didn't we just go through this recently?

In Access, surround dates with # and you are good to go.

if you are using functions or variables, you don't even need that:

update table set [date] = datevariable

or

update table set [date] = #1/1/2003#

or

update table set [date]= dateserial(2003,1,1)

or

update table set [date] = CDate("1/1/2003")


hopefully some of those will help you out !

- Jeff
Go to Top of Page

gagan
Starting Member

5 Posts

Posted - 2003-08-01 : 17:36:16
Thanx! guy's.
I still have a problem

I have t0 pass a variable when i set the date
Go to Top of Page

gagan
Starting Member

5 Posts

Posted - 2003-08-01 : 19:18:12
I figured it out, I wasn't putting : in front of the variable
Thanx to all for their time
Gagan
Go to Top of Page
   

- Advertisement -