Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




How 2 Pass NULL To Date DataType ?


I'm Importing, exporting data to a text file using the Write/Input method.
when the app. writes 2 a textfile, if the value in the date field is Null, it putz #NULL# in place of the field. When reading frm the same textfile, it givz an error as the variable tt Im using to recieve the value is of date type. How do I go around this problem?

and, how exactly can I pass NULL 2 a Date type variable ?

dim dtest as Date
dtest= NULL

givz error




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Variant Datatype Check For Null
Variant datatype check for null ...?

ALTER TABLE MODIFY Datatype NULL Property
I have a statement that I need to get to work on both Access Databases and SQL Server.

For access, I use:
ALTER TABLE [Folder] ADD MyField longText NULL

In SQL Server, I use:
ALTER TABLE [Folder] ADD MyField longText NULL

How come SQL Server sets the field to allow-nulls, whilst the access version, with no error, create the field but does not set it to allow-nulls.

I have also tried the ALTER TABLE MODIFY and although I do not get an error from Access (pasting the statement directly into the query window) the field is modified but not the allow-nulls.

Am I missing something? Thanks!

Insert NULL Value Into Stored Proc Parameter Datatype Uniqueidentifier
How can I insert NULL value into Stored Proc parameter datatype uniqueidentifier.

My stored proc
CODEREATE PROCEDURE [bookstore_insert_WebList]
    ( @ParentID     [uniqueidentifier],
     @MasterID     [uniqueidentifier],
     @ListLevel     [int],


Date String To Oracle Date Datatype
I have variable that holds a date string looking like this: '05312002140059'
[The format is read as: 'mm/dd/yyyy hh24:mi:ss']. I need to execute a stored procedure
in Oracle through VB. The date string comes from a tab delimited text file, which is
read into a string variable in VB. From there, I want to assign the value in the
string varible to the Command object's parameters. The error that I'm getting is
that the string's datatype is mismatched or invalid with the stored procedure's
data type. What am I doing wrong?!

Pass Null For An Object
I have a function that gets passed a progressbar. However, I have a case where I want to use the function in another form that doesn't require a progress bar.

Is there something I can pass as NULL or do I have to have a fake textbox?

How Can I Pass A Null Value Through A Function
How can I pass a null value through a function?

How Can I Pass A Null To The Table ?
How Can I pass a null to the table through the textbox

I got the ado control and textbox, I want to pass a null value to the column of the table that attach to the textbox

Please help me. Thanks you so much

Pb To Pass Null To A Function
Hi,

I have a dll function like :


public Declare Function myfunc Lib "mydll.dll" (byval b1 as Byte, byref pInt1 as Integer, byref pInt2 as Integer, byref pInt3 as Integer, byref pByte1 as Byte, byval int1 as Integer, byval int2 as Integer) as Integer




And want to pass a Null pointer for pInt1 and pInt2 pointer like :

Dim MyTabInt(16) as integer
Dim MyTabByte(8) as integer


call MyFunc(0xFF, ??? , ??? , MyTabInt(0), MyTabByte(0), 0, 0)




What syntax can I use :

I tried to pass 0 without success. (my pointeur have a value when I debug my dll)

And Null is avoid by the VB compiler.

Can someone give me the correct syntax.

Thanks in advance,
Laurent.

Pass Null To API Function
M$ tip

Often, depending on the API function, you'll want to pass a Null
value (0&) in one of the arguments. Unfortunately, depending on
the function's declaration, Visual Basic may generate an error
when you try to do so. For instance, consider the following API
declaration copied directly from the API Viewer:

Public Declare Function ScrollWindowEx Lib _
"user32" (ByVal hwnd As Long, ByVal dx As Long, _
ByVal dy As Long, lprcScroll As RECT, _
lprcClip As RECT, ByVal hrgnUpdate As Long, _
lprcUpdate As RECT, ByVal fuScroll As Long) As Long

As you can see, this function takes several RECT structures that
define the area Windows should scroll. However, when you pass in
null for most of these arguments, Windows will define these areas
for you, provided it knows to which window to apply them. As a
result, the following statement is valid:

ScrollWindowEx m_hWnd, 0, 5, ByVal 0&, ByVal 0&, 0&, ByVal 0&, _
SW_SCROLLCHILDREN Or SW_INVALIDATE

Unfortunately, as is, VB generates an error if you try this with the
previous declaration. To allow the function to accept Null values,
you'll need to adjust each argument's data types from RECT to Any, like so:

Public Declare Function ScrollWindowEx Lib _
"user32" (ByVal hwnd As Long, ByVal dx As _
Long, ByVal dy As Long, lprcScroll As Any, _
lprcClip As Any, ByVal hrgnUpdate As Long, _
lprcUpdate As Any, ByVal fuScroll As Long) As Long

With this declaration in place, the Null values will work like a charm.



Iouri Boutchkine
iouri@hotsheet.com

Date Datatype
Hi

If I Want To Give The Null Value To The Date Datatype.

Eg: Dim DcDate as Date

After Stored Some Date Value In That Variable I Want To Clear The Value To Null .

Some Suggestions Please.

Date Datatype
I have string "5/1/2006 6:00:00:AM". How can I convert it to date?
every time I try to use date function such as isdate or cdate it gives me type mismatch.

Datatype Date
Hi,

How do I assign a NULL into a variable of datatype date? The database can accept null or datetime.

Thanks

How To Pass A NULL Value To A Stored Procedure
I am upgrading the Crystal Report from 6.0 to 9.0 and following problem has been encountered.

My program has a function to let the user to input the date range in order to print out the appropriate records. If no date is entered, all the records will be shown.

For Crystal Report 6, following codes works fine:
CrystalReport1.StoredProcParam(0) = ""

Howerver, after I've re-written the codes for upgrading, no records can be retrieved.

Dim crxParameterField As CRAXDRT.ParameterFieldDefinition
Set crxParameterField = Report.ParameterFields.Item(1)
crxParameterField.EnableNullValue = True
crxParameterField.AddCurrentValue Empty

It seems like an empty string has been passed instead of a NULL value.
I need to pass a NULL value to the parameter with type "datetime" in the stored procedure.

Any idea how can I fix this problem without modifying the stored procedure? Please help!

How To Pass A Pointer To A NULL For C Library?
I am having trouble figuring out how to pass a NULL value to a C DLL from VB.

The call in C is as such...

StartMsg(ChannelId, PASS_TYPE, &Msg1, &Msg2, NULL, &Filter1)


In VB I declare and call it as such...

Public Declare Functio StartMsg Lib "blah.dll" ( _
ByVal Channel as Long, _
ByVal Filter as Long, _
pMsg1 as Msg, _
pMsg2 as Msg, _
pMsg3 as Msg, _
pFilt as long) as Long

Status = StartMsg(ChannelId, PASS_TYPE, Msg1, Msg2, vbNull, Filter1)


The vbNull is where I want to pass a NULL like in the C example. It throws a ByRef error. The C routine requires a pointer to a NULL value. I've tried creating my own MyNull and setting it to NULL, and passing that, to no avail.

Jeff

Can't Pass NULL Instead Of Type As Byval
I am trying to call the RedrawWindow function like this:
RedrawWindow ProgHwnd, ByVal 0&, ByVal 0&, RDW_INVALIDATE
got this off API Guide, and I am getting an error "User Defined Type cannot be passed byval", although I really want to pass a null instead of a Rect structure. OTOH, when I take out the Byval,I get an error "ByRef argument type mismatch". So how do you pass a null instead of a type to a function?

Pass Null String To API Function In Vb.net
Hi,

I am using the FindWindow function from the user32 dll, it takes 2 paramater values:

class = string
Window Name = string

and the docco says that you can use only one of these paramaters if you want and pass a null string for the other paramater?

Pass A Null Value To A Stored Procedure
Hey all!  I'm trying to pass a NULL value to a stored procedure.  I've done it before using variable dim'd as variant but in this case I need to pass a null string variable to an element in an array dimed as string.  Should this be done here or handled in the SP?

CODE'THIS ARRAY WILL HOLD THE VALUES IN THE LABEL
aryIn = Split(txtScanIn, ";")

'THIS ARRAY IS USED BECAUSE WE HAVE TO SPLIT PART OF THE ABOVE ARRAY BECAUSE THE SPN AND REV ARE TOGETHER AAA.BBB WE MUST SPLIT THAT ELEMENT AGAIN TO GET SEPERATE THE AAA AND BBB.

arySPNREV = Split(aryIn(1), ".")
If UBound(arySPNREV) = 0 Then
    ReDim Preserve arySPNREV(UBound(arySPNREV) + 1)
    
    arySPNREV(1) = vbNullString
End If

Date Time Datatype Help!!
hi please help

i am using microsoft access 2000 i have a textbox which its datatype is date/time as a custom format i added to the format property of the table "dd/mm/yyyy".

on my form i a have added this code as follows for the got focus


Code:
Private Sub date_GotFocus()
Me.date.Format = ("dd/mm/yyyy")
End Sub

on my lost focus i have this code:

Code:
Private Sub date_LostFocus()
If Me.date.Format <> Format("dd/mm/yyyy") Then
MsgBox "alert"
Me.date.SetFocus
Exit Sub
If Not (Me.date <> "general date") Or IsNull(Me.date) = False Then
MsgBox "Required and format dd/mm/yyyy"
Me.date.SetFocus
Exit Sub
End If
End If
End Sub

my problem is whenever i click the other controls on my table (meaning textboxes or labels i get this error message "The Value you entered is not valid for this fields" - "for example you have entered text in a numeric field or a number that is larger than the fieldsize setting permits"

can some one please help... thanks in advance

Beginners Q On Date Datatype.
Hi
Can someone tell me why this works in my program:

Dim startdate As Date
Dim enddate As Date
Dim d, m, y, td, tm, ty As Integer

d = Day.Text
m = Month.Text
y = year.Text
td = today.Text
tm = tomonth.Text
ty = toyear.Text

startdate = d & " " & m & " " & y
enddate = td & " " & tm & " " & ty





But NOT this:

Dim thisdate As Date
Dim recday, recmonth, recyear As Integer


recday = CSng(Adodc1.Recordset.Fields("day"))
recmonth = CSng(Adodc1.Recordset.Fields("month"))
recyear = CSng(Adodc1.Recordset.Fields("year"))

thisdate = recday & " " & recmonth & " " & recyear

I get a type-mismatch error and the debugger sends me to the last line above...

cheers..

Sql Server And Date Datatype
Hello,

I am having so much fun with this date datatype in SQL and VB.

I am trying to update a date column defined as smalldatetime and I am using a dtpicker to choose the date. I am using:

Set PerAcreRs = PerAcreConn.Execute("Update collection set collectionRddno = '" + txtColRddNo.Text + "', collectionamount = " + FormatCurrency(txtColAmount.Text, 2, vbTrue, vbFalse, vbFalse) + ", collectionstaffname = '" & _
txtStaffName.Text + "', collectiondate = " + Format(dtCol_CollectionDate.Value, "mm/dd/yyyy") + ", collectiontadmappg = '" + txtColTadMapPg.Text + "', collectionmapscopg = '" + txtMapscoPg.Text + "', collectioncheckdate =" & _
Format(dtColDateOnCheck.Value, "mm/dd/yyyy") + ", collectionreimbcheckno ='" + txtColReimbAdd_CheckNo.Text + "', collectioncomments ='" + txtColComments + "', CollectionDevTaxId_FK = '" + ColDevTaxId + "', CollectionLineNo_FK ='" & _
cmbColLineInfo.Text + "', CollectionLineSwrFrom_FK = '" + cmbColSwrStnFrom.Text + "', CollectionLineSwrTo = '" + cmbSwrStnTo.Text + "' where collectionrddno ='" + mshColSearch.Text + "'")

as my update statement. For some reason, all the dates come across as "1900-01-01 00:00:00".

I don't want to change the datatype because then I have to go and change lot of other code based on the date datatype.

I have been looking at this for hours trying different things but not been successful. I need another set of eyes for help.

Thanks and appreciate all your help,

Raj Antony V

Date Datatype And SQL Server
Hello,

I need your help in troubleshooting an error that I have been getting recently. I am storing dates into a sqlserver smalldatetime column and it is being stored as "2002-02-02 00:00:00" values.

On the VB form, I am using a dtpicker with dateformat of "short date" and before I insert the date, I format the date to as a "mm/dd/yyyy" format using format function of VB.

PerAcreRs.AddNew
PerAcreRs.Fields("CollectionRDDNo") = txtColRddNo.Text
PerAcreRs.Fields("CollectionAmount") = CCur(txtColAmount.Text)
PerAcreRs.Fields("CollectionStaffName") = txtStaffName.Text
PerAcreRs.Fields("CollectionDate") = CDate(Format(dtCol_CollectionDate.Value, "mm/dd/yyyy"))
PerAcreRs.Fields("CollectionTadMapPg") = txtColTadMapPg.Text
PerAcreRs.Fields("CollectionMapscoPg") = txtMapscoPg.Text
PerAcreRs.Fields("CollectionCheckDate") = CDate(Format(dtColDateOnCheck.Value, "mm/dd/yyyy"))
PerAcreRs.Fields("CollectionReimbCheckNo") = txtColReimbAdd_CheckNo.Text
PerAcreRs.Fields("CollectionDevTaxId_FK") = DeveloperIdInfo
PerAcreRs.Fields("CollectionComments") = txtColComments.Text
PerAcreRs.Fields("CollectionLineNo_FK") = cmbColLineInfo.Text
PerAcreRs.Fields("CollectionLineSwrFrom_FK") = cmbColSwrStnFrom.Text
PerAcreRs.Fields("CollectionLineSwrTo") = cmbSwrStnTo.Text
PerAcreRs.Update


Once stored, I would like to retrieve data in the table based on this date field. So I do a "> = and < =" as shown below:

Set PerAcreRs = PerAcreConn.Execute("Select * from collection where CollectionLineNo_FK = '" + cmbColLineNoSearch.Text & _
"' and CollectionLineSwrFrom_FK = '" + cmbSwrStnFromSearch.Text + "' and CollectionLineSwrTo ='" + cmbSwrStnToSearch.Text & _
"' and CollectionReimbCheckNo ='" + txtColCheckNoSearch.Text + "' and CollectionDate >= " + dtColSearchDateFrom.Value + " and CollectionDate <= " + dtColSearchDateTo.Value)

When I query the SQL Server using query analyzer the date is shown as "2002-02-02 00:00:00" and I am trying to do a comparison that is not going to match.

Do you know of any ways to get around this problem? Thanks and appreciate all your help,

Raj Antony V

Problems With Date Datatype
is it possible to replace an empty date field of a single record with something other than a date?
I have records where some have no birth date entered. Instead of a blank field or (as i currently have) the date 01/01/1900, can i have say: N/A

Retrieve Date Datatype
'm still confuse..

here is my data at dbase

field-------------datatype--------length------------format
---------------------------------------------------------------------------
date_enter----date/time---------------------------dd - mm - yyyy
time_enter----date/time----------------------------short time
desc------------text---------------50

and the value is :
10 - 09 - 2004 13:48 remind about something
11 - 09 - 2004 14:50 remind me again

i'm using this query from the dbase

Code:

"SELECT * FROM table_name WHERE date_enter = " & date & " AND " & _
" time_enter = " & time & " ORDER BY date_enter "


if i'm using that method..the record won't display anything unless i change the query to be something like this..


Code:

"SELECT * FROM table_name WHERE day(date_enter) = " & day(date) & " AND " & _
" month(date_enter) = " & month(date) & " AND " & _
" year(date_enter) = " & year(date) & " AND " & _
" time_enter = " & time & " ORDER BY date_enter "


well...as it looks...it not a short query..but it works..
i already try Twodogs and d-u method but none of that is works..

plz help..

Date Datatype Problem
I am retrieving a recordset from my database where the values are date datatypes and are NULL. I am using the is null function as follows:

if isNull(vntDetails(2,0)) then
   mdteDate = ""
else
    mdteDate = vntDetails(2,0)
end if

I am getting an error because the date varible type does not recognize "". Is there another way to display nothing for the date in the text box on my form?


Problem In Date (Datatype)
Hi,

I am having a field called Pet_dt declared as 'Date'. I am inserting a data to this field like

rs!pet_dt=format(date,"dd-mm-yyyy").

But if i see the data for the pet_dt in Visual Data Manager it is looks like the format of "dd-mm-"

But in my actual backend(access) i am having data as it is.
("dd-mm-yyyy")

Why it is displaying so in Visual Data Manager and how to change this to the actual format.

How To Pass Null In Stored Procedures Of ORACLE From VB
Hi there,
I want to execute a stored procedure having some parameters, the procedure is simply executing an insert query for a table, now I want to pass NULL value for some of the fields, I had tried this, but it gave the error
-----------------

execute SP_INS_CMN_CASH_RECEIPT_DET(1,1,0,50,'A',428086,'13-APR-2004',1,NULL,NULL,2,2004,'2312-1010-0082',1,9000,NULL,'N','N','01-JAN-2002','01-JAN-2002','N')
----------------
I had also left blank the values which I wanna to be NULL, The error is


--------------
BEGIN SP_INS_CMN_CASH_RECEIPT_DET(1,1,0,50,'A',428086,'1
3-APR-2004',1,,,2,2004,'2312-1010-0082',1,90

*
ERROR at line 1:
ORA-06550: line 1, column 71:
PLS-00103: Encountered the symbol "," when expecting one of the following:
( - + mod not null others <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current exists max min prior sql stddev sum variance
execute cast trim forall
<a string literal with character set specification>
<a number> <a single-quoted SQL string>
The symbol "null was inserted before "," to continue.
ORA-06550: line 1, column 104:
PLS-00103: Encountered the symbol "," when expecting one of the following:
( - + mod not null others <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current exists max min prior sql stddev sum
-----------------------------
The stored procedure is attached as a .sql file.
Please help.
Thanking u in anticipation
RGDS
Amit



 

URGENT: - How Do I Pass Null To A Structure Argument ?
I am calling an API CreateProcess. It takes 2 structure parameters. I want to pass Null to these. In VC++ , I can pass it as Null. How do I do it in VB ?


VbNull,Null and vbNullString are not accepted


Anand

Date String To Oracle Datatype?
I have variable that holds a date string looking like this: '05312002140059'
[The format is read as: 'mm/dd/yyyy hh24:mi:ss']. I need to execute a stored procedure
in Oracle through VB. The date string comes from a tab delimited text file, which is
read into a string variable in VB. From there, I want to assign the value in the
string varible to the Command object's parameters. The error that I'm getting is
that the string's datatype is mismatched or invalid with the stored procedure's
data type. What am I doing wrong?!

Unix Timestamp To Sql Date Datatype
i have a field in my mysql that is of int datatype and contains the unix timestamp how can i convert this and save it back to the database in a datetime field.

Searching With DATE/time Datatype
Hi,

I have a programme which search for records for an Access database through Ado.Recordset object. I open the record using this sql

'con is the connection which is opened and active now
'and say mDOB=3/4/2003 3rd april
rs.open("Select * from Students where DOB = #" & mDOB & "#",con

--------
the above line opens the recordset with no records but in my table I have records for this date. when i give this command

msgbox mDOB

this displays the date correctly --> 3/4/2003

msgbox format(mDOB,"dd mmm yyyy") --> 3 Apr 2003

I think my sql is converting the date into 4/3/2003 format when it search for database (may be not!!!)

does anybody else faced problem like this?, did u find any solution? or is there any other solution for this problem (may be any SET statements at the beginning!!!)

I really tried my line in many different ways

rs.open("Select * from Students where DOB = #" & format(mDOB,"mm/dd/yyyy") & "#",con
'this gave me the result correctly. but I am not sure about this solution is correct or not.

I am looking forward for some solutions please...

cheers
kishor


 

Date Time Picker Control: How Do Set The Displayed Date To Null?
I have a front end database form with date fields using the MS dtp control. The fields are unbound, but populated using a data class. The problem is that on many occasions the date field is Null, ie no data available. On display the dtp control always defaults to a set date, usually today (this is a property function of the control). What I can't seem to do is to display no date, or to delete the date displayed. Any thoughts would be very gratefully recieved. API perhaps?

I'm trying very hard not to have to write an Active-X control based on the dtp (mainly because of multilingual support and different localisation issues regarding dd/mm/yyyy (used by 90% of the world's population, and mm/dd/yyy - used by the remaining 10% in the US - sorry just had to get that jibe in for those of us who despair at having to go in to custom formatting in Excel simply to get dd/mm/yy )

Many thanks

Cannot Transfer Date Datatype From SQL Server To MS FlexGrid
Hi Guys!

Why is it that I cannot transfer a Date datatype to my MSFlexGrid? How will I deal with this? Please help me.

Thank you.

Regards,
BarberCut

Problem When Update Database With A Date Datatype ?
I have a form with a few textboxes and a date field input (called txtDate). First of all, I will add all data on that form in SQL databse. I will insert NULL if txtdate is emplty. Later if I edit the form but don' edit txtdate. I have problem is in SQL database, the txtdate is added '1/1/1900' in. Why it happen ? I want that column should be blank when has no data. I used date type in database. I'm not sure that it's more easier if use nvarchar or int because I need to compare or search date later on. Do you know how to deal with it ? Thanks

Access Date Compare Datatype Problem
Hey guys,

I've got a problem withe the WHERE clausule of my query.
In my database records are stored and all have a field Start_Timestamp and Stop_Timestamp (both Date/Time format)

When I execute a query like :
CODESELECT * FROM table WHERE number = 1000
  AND Start_Timestamp > '1-3-2005 14:32:17'
  ORDER BY number

Updating Date Field With Null Value (date Picker)
Hello,

I am using VB and access. For date I am nsing date Picker. How can I update a date with null value?

I am using the code update the date field:

DateColumn=#" & Format(DTP1, "mm/dd/yyyy") & "#

When I try to udate the field with null value I receive error: syntex error in date in query expression '##'.
Please advice me how to update with null values.

Regards,
Elahi

Blank Date (null Date)
How do I create a blank Date ( / / ) to pass it to a field

Creating A Vb Datatype To Represent Cobol Datatype
I'm rewriting a COBOL program to a VB program at the moment. I haven't found a tool to do the conversion for me, so I have to go at this by typing line by line for now.

Currently, I'm trying to come up with a routine that does the mentioned task. Create a Declaration system in VB that describes a data layout of records and variables along with their datatypes in the COBOL program.

It's easy to represent a variable of COBOL string datatype ..We use the VB String datatype..so PIC X(5) could be STRING * 5 in VB

I guess I could use the Double datatype, When representing variables in COBOL like PIC 9(3) or S9(6)V999, etc.

And then we have to worry about "redefining" a variable with includes a combination of COBOL variable types. A routine that represents the REDEFINE command in COBOL.

I guess I have to think about it for a while. I could use any suggestions.

NULL Date?
Can anyone tell me why the Date function in the expression for DateBox.DefaultValue is returning NULL?


Code:
Option Compare Database
Option Explicit

Dim x_Count As Integer

Private Sub Command29_Click()
x_Count = x_Count - 1
place_holder.Value = x_Count
DateBox.DefaultValue = IIf(WeekDay(Date, 1) = 2, Date - place_holder.Value, Date - place_holder.Value)
End Sub

Date Value Null
how do i make a date value null?

Null Date
I have a VB app which uses an Access db. On a form there are several date fields which the user can enter. No fields are required; there can be a valid date or no entry at all. In the db, all the date fields are defined as "Required = No". However, if there currently is a date value in the field and it needs to be removed (a blank field), I get a "data type conversion error". I realize I'm getting the error because I'm trying to put a non-date in a date field. Here is my code. In this example, tClosedDate is the text box on the form, RS!ClosedDate is the field in the db and the current value of RS!ClosedDate is 11/01/2003:

If tClosedDate > "" then
RS!ClosedDate = tClosedDate
Else
RS!ClosedDate = ""
End If

Is there a way to get the date field in the db back to blank once a value is put into the field?
Thanks in advance.

Null Date Help Please!
Hi. I am making an application that displays dates. The problem is that when I tell a textbox to pull a date from the Access database and there is nothing in the recordset to display, it gives me the Error: Invalid use of Null. How can I avoid this?

This is my code that I use:

Dim c as ADODB.Connection
Dim r as ADODB.Recordset

Private Sub Form_Load()
Set r = New ADODB.Recordset
Set c = New ADODB.Connection
c.open connection string
r.open "select blah;", c, adOpenKeyset, adLockOptimistic
'Now say r has a field named "BDAY" and Text1 is a textbox
Text1.Text=r("BDAY")
End Sub

End the code.

This will display the date if there is one. I made it so that you could navigate records, and when it hits a record that dosen't have a date entered in the database I get that error. I was wondering if I could do a If statement check, or something, but I have tried everthing I could think of and I need help. Please!

How Do I Set A Date Value To Null??
Hi,

Does anyone know how I can set nulldate to null in the code below? At the moment I have to set it to 00/00/00 which when pulled from the database using a web interface shows up as some date in the 1800s. I have to go into sql server and edit the fields manually at the moment which is a bit of a pain. Any ideas?

Neil.

Public Function NullDate() As Date
ThisErrorLog.FunctionName = "NullDate"
On Error GoTo err

NullDate = DateValue("00:00:00")
Exit Function
err:
ThisErrorLog.ErrorDescription = err.Description
ThisErrorLog.ErrorNumber = err.Number

LoadErrorLog

Date Is Null??
I have a form with check boxes. When I check the box, I have code that populates a table field with todays date.

This, upon clicking the check box, I want to...

Tables!tblABC.fieldname.value = Date

First, I am wondering idf there is anything wrong with this syntax. However, if I do something basic like...

MsgBox Date on the control, I get an Invalid Use of Null error. I'm confused because shouldn't Date be today's date?


Thanks in advcance for any help you can provide.

Date Vs NULL
I have defined a variable XPROOFSUBDATE as string. If the text filed has a date in it, it becomes a date


VB Code:
If IsDate(txtProofSubDate.Text) Then    XPROOFSUBDATE = Trim(txtProofSubDate.Text)Else    XPROOFSUBDATE = ""End If


Later, when I am putting the INSERT satement together, I check this string value. If it is a date, then I post the date, other I post a NULL.

[highlight=VB]
If IsDate(XPROOFSUBDATE) Then
SQLINSERT = SQLINSERT & "'" & CDate(XPROOFSUBDATE) & "', "
else
SQLINSERT = SQLINSERT & "'" & Null & "', "
End If
[vbcode]

What is coming into the field is not NULL, but rather 1/1/1900.

Any ideas?

Null Date Value
I am using the ISNULL function and i need to know what is the acceptable null value of a date so that i can include it in my code for errorchecking. I know that 0 is the null value for integers and currency, does it work for the date too, or is there a diffeent value that must be used.

Please Help!

Null Date
I need help with this null date problem. I have a form that is used
to edit information for several tables, and it is done with the
form unbound from tables to minimize opportunities for making
entry mistakes. To make a long story short, once the editing is
done, the edited fields are written to a user defined variable
that has been defined with all the same fields and types as the
table and the actual update is done with DAO .edit and
.update recordset methods. This all works fine exept it will
occasionally be necessary in editing to delete a date. When
that happens the field becomes null, of course, but when
the null value is written to the table, it becomes 12/301899.
That won't work. It must be a blank field when there is no
date entered. How can I make it work this way?

How To Pass A DATE ?
How to pass a DATE from vbcode to the crystal report ?
i tried to make :
crystalreport1.formulas(0) = "date1 = " & f1

where f1 is a variable which contains the date which i want it to be passed to the crystal report.

but the report shows only a string not a date ...(part of the date)

suppose my date is 21/06/01 ..when i pass it to the report it shows : 21.00


any body ?

Setting A Date To A Null Value
In Access 2000, how do I set a date field to a null value? I tried

Me.DateField = " " , but I get an error message.

Thanks in advance

Copyright 2005-08 www.BigResource.com, All rights reserved