Solved

Using sysdate in VB

Posted on 2002-04-03
8
3,243 Views
Last Modified: 2008-02-01
Hi,

I have a program which has a date when a new row is entered, but I want this date to use sysdate from oracle as opposed to now in vb, but I am not sure if it is possible other than to use a trigger, or straight insert into statement.


.AddNew
!StatusLogID = GetNextId
!STATUSLOGDATEOFCHANGE = Format(Now(), "dd-mmm-
.update
0
Comment
Question by:damienm
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6915359
The only way I have managed to do this is with a SQL statement, in your case an Insert.

Anthony
0
 

Expert Comment

by:mmonacel
ID: 6916274
I would suggest what Anthony had said - write the date as you enter into the DB.  Maybe you can "fake it" by after inserting the record, making a call to retrieve that value from the DB and display it on the screen.  Seems like a lot of overhead to do just to display a date, but if you need it...

0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6916421
mmonacel

I suspect damienm needs the Server date/time not the workstation date/time.

Anthony
0
 
LVL 39

Expert Comment

by:appari
ID: 6916797
or in formload get date from oracle by opening a recordset, keep that in a form level variable and use it whenever you want. but take care to handle the special cases like form may be loaded at 23:59 and update is done at 00:01 the next day ( after 2 minutes).
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6916836
appari,

I suspect damienm is looking for the time as well.

Anthony
0
 
LVL 39

Accepted Solution

by:
appari earned 50 total points
ID: 6916873
why dont you define a default on that column and assign datevalue and forget about its updation?

like

create table test1( A1 date default sysdate,A2 char(2))

0
 
LVL 2

Author Comment

by:damienm
ID: 6917411
This is what I did, except by using alter table.

i.e.

alter table statuslogs
modify (statuslogdateofchange default sysdate)

so that I do not need to put this into the insert statement.
0
 
LVL 2

Author Comment

by:damienm
ID: 6917414
This is what I did, except by using alter table.

i.e.

alter table statuslogs
modify (statuslogdateofchange default sysdate)

so that I do not need to put this into the insert statement.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now