Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SQL Update is dropping leading Zeros? ((a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    I have the following code in a check writer report Private Sub Detail_Format section

    <pre>Dim CheckNo As String
    CheckNo = Format(Me.strCHECKNO, "00000")
    MsgBox "CheckNo : " & CheckNo

    strSQL = "UPDATE " & strTableName & _
    " SET strCHECKNO = " & CheckNo & ", " & _
    " strOK = " & Chr(34) & "Y" & Chr(34) & ", " & _
    " dteSUMDAY = #" & Me.dteSUMDAY & "#" & _
    " WHERE " & lngID & " = " & Me.idsKeyOfSumServe


    DoCmd.RunSQL strSQL
    </pre>


    Check number 00101 prints on the check, it also dispalys 00101 in debug MsgBox OK

    However when I look at the result of the SQL Update 101 is stored in the strCHECKNO field

    It should contain 00101

    strCHECKNO is a 8 character text field

    Any clues on how I can get 00101 stored in th srtCHECKNO field?

    Thanks, John

  2. #2
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SQL Update is dropping leading Zeros? ((a2k (9.0.6926) SP-3 Jet 4.0 SP

    try

    <pre> strSQL = "UPDATE " & strTableName & _
    " SET strCHECKNO = " & Chr(34) & CheckNo & Chr(34) & ", " & _
    " strOK = " & Chr(34) & "Y" & Chr(34) & ", " & _
    " dteSUMDAY = #" & Me.dteSUMDAY & "#" & _
    " WHERE " & lngID & " = " & Me.idsKeyOfSumServe
    </pre>


  3. #3
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SQL Update is dropping leading Zeros? ((a2k (9.0.6926) SP-3 Jet 4.0 SP

    <img src=/S/rofl.gif border=0 alt=rofl width=15 height=15> If that works, shouldn't you say thanks?
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

Posting Permissions

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