Re: Date Variable




"Joel" <joel@xxxxxxxxx> wrote in message news:_Rb_e.13183$gi4.5691@xxxxxxxxxxx
>
> So if datDate = 0 VB will interpret it to be 12/30/1899? And I assume
> assigning 0 to datDate is the only way to initialize it?
>
> Also in my old DB I have a field Date_Paid defined as Date. What I would do
> would test the value of the field if Date_Paid = "" It would mean the
> record (transaction) is open. How do I test for such a condition now? I'm
> using MySql.
>
> Also I have a series of programs that does all kinds of updates. In order to
> assure that procees was completed properly I have this safeguard: Before
> that program is started I assign datProcess (Date Filed...MySql) to equal
> Todays date datProcess = Today when I complete the job I null out (or used
> to) the date. How do I do it now? (If I assign 0 then the field has a
> value!)
>
> Thank You
>

There is a big difference between date fields stored in a database, and a date
variable within your program.

Most database fields should be considered equivalent to Variant variables. They
can be set to Null, unless the field is set otherwise in the database. For field
types other than text, this is what we would call blank.

For a field in a recordset, you can check for null using
If IsNull(RecSet("FieldName")) Then
' it is null, i.e. blank..
Else
' it has a value...
End If

Similarly, you can set a field to a value or to null:
If Completed Then
RecSet("FieldName") = Null
Else
RecSet("FieldName") = Date()
End If



.



Relevant Pages

  • Re: chances of getting error no 87, hr = 2147221000 (CO_E_DLLNOTFOUND on SQL CE 2.0)
    ... your database instead of CoCreating every 2 minutes. ... Open method for opening the connection to the database. ... This is the static routine to initialize the connection. ... | of such a static routine provides the alternate means to do the same. ...
    (microsoft.public.sqlserver.ce)
  • Re: abstract sub programs overriding
    ... persistent data type, where the necessary data is read from a database, ... then the parent initialize can be called last. ... propagate the exception outward). ... the compiler can determine at ...
    (comp.lang.ada)
  • Re: XP SP2 problem
    ... that copies values from my data storage to recordset. ... value is actually written in database. ... The fields will initialize themselves correctly if you ... AddNew and pass array with names of all the columns and array with all the ...
    (microsoft.public.access.replication)
  • Re: IAS Service doest start
    ... There seems to be something wrong with your database, ... > I sent a post in Feb 17, and was asked to send a trace. ... > retrieve the Service SDO for service: IAS... ... > GetServiceSDO- Could not initialize the SDO schema... ...
    (microsoft.public.internet.radius)
  • Re: XP SP2 problem
    ... value is actually written in database. ... I didn't know you could edit data in the s_Generation field. ... a Jet replication field, and I thought was completely unavailable ... The fields will initialize themselves correctly if you ...
    (microsoft.public.access.replication)