Results 1 to 8 of 8

Thread: [RESOLVED] Saving Date as NULL

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2004
    Location
    Quetta-Pakistan
    Posts
    852

    Resolved [RESOLVED] Saving Date as NULL

    Hi,
    I want to save the red highlighted date as null, using VB 6 and Access 2003 as back end, my code is as under, but not giving the desired result.
    Code:
                mSQL = "Insert into tblChqMaster Values(" & mChqMasterId & ", #" & txtDate & "#, " & fgData.TextMatrix(sRow, 4) & ", #" & txtDate & "#, " & Val(PartyId) & ", #" & txtDate & "#, " & 0 & ", '" & "Own" & "', '" & "-" & "', " & Val(UserId) & ")"
                mSQL = Replace(mSQL, "##", "NULL")
    db.Execute mSQL
    Please help me

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Saving Date as NULL

    If your date field allows null value then what I would do is mto include list of fields in your sql statement excluding the date field:
    Code:
    insert in tblChqMaster
        (fld1, fld2, fld5)
    values
        (val1, val2, val5)
    This way you can control which fields are getting values inserted. On the other hand if list of fields is omitted then the entire list is applied.

  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Saving Date as NULL

    *koff*parameters*koff*koff*

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    5,263

    Re: Saving Date as NULL

    Quote Originally Posted by techgnome View Post
    *koff*parameters*koff*koff*

    -tg
    I would offer you some cough drops.....
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  5. #5

  6. #6
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Saving Date as NULL

    hehehe... No... it was directed at the OP... there's plenty of ways to skin this cat...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    May 2004
    Location
    Quetta-Pakistan
    Posts
    852

    Re: Saving Date as NULL

    Thanks RhinoBull, issue resolved

  8. #8

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width