Re: Date Variable
- From: "Steve Gerrard" <mynamehere@xxxxxxxxxxx>
- Date: Tue, 27 Sep 2005 08:21:24 -0700
"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
.
- References:
- Date Variable
- From: Joel
- Re: Date Variable
- From: Rick Rothstein [MVP - Visual Basic]
- Re: Date Variable
- From: Joel
- Re: Date Variable
- From: Rick Rothstein [MVP - Visual Basic]
- Re: Date Variable
- From: Joel
- Date Variable
- Prev by Date: Re: Help with ComboBox
- Next by Date: Re: Printing to only USB printer
- Previous by thread: Re: Date Variable
- Next by thread: Retrieving OS parameters specific to processes
- Index(es):
Relevant Pages
|