Results 1 to 6 of 6

Thread: Update database problem

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2005
    Posts
    43

    Update database problem

    Please help: Struggling as a beginner in South Africa
    Having problems with updating Access database.
    I have data in the field(s) and I am trying to update the field with Null, In other words replace the current data witg nothing.
    It work if fields are text but not if a number.

    Data type in database is Number, Long Integer, not required


    Code on form:

    Private Sub cmdUpdate_Click()

    Data3.UpdateRecord
    Data3.Recordset.bookMark = Data3.Recordset.LastModified

    updateerror:
    MsgBox Err.Description

    End Sub

    This returns error massage: Data type conversion error

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Update database problem

    If it is a number, replace it with 0

  3. #3
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: Update database problem

    Are you using an empty string as null ('') or the keyword NULL. Number can be set to NULL by using the word NULL (do not place it inside single qoutes).
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  4. #4

    Thread Starter
    Member
    Join Date
    Jul 2005
    Posts
    43

    Thanks both but:

    Thanks for the reply but replacing will O will not help.

    The fields in the database hold case number data and is used on my packing slip to indicate how many cartons are used.

    Input 2 cartons
    1 case


    Replacing second with 0 will show on report as for example:
    Packed into: 2 cartons
    0

    instead of using form calculation to show on report

    All packed into 2 cartons

    Do not know how to code using Null

  5. #5
    Frenzied Member d3gerald's Avatar
    Join Date
    Jan 2006
    Posts
    1,348

    Re: Update database problem

    i suggest you get rid of the data control and start migrating to ado

    this link here can help you

    http://www.connectionstrings.com
    On error goto Trap

    Trap:
    in case of emergency, drop the case...

    ****************************************
    If this post has been resolved. Please mark it as "Resolved" by going through the "Thread Tools" above and clicking on the "Mark Thread Resolved " option.
    if a post is helpful to you, Please Rate it by clicking on the Rate link right below the avatar

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Thanks both but:

    Quote Originally Posted by RayComp
    Thanks for the reply but replacing will O will not help.

    The fields in the database hold case number data and is used on my packing slip to indicate how many cartons are used.

    Input 2 cartons
    1 case


    Replacing second with 0 will show on report as for example:
    Packed into: 2 cartons
    0

    instead of using form calculation to show on report

    All packed into 2 cartons

    Do not know how to code using Null
    As you have seen, Null will give you a problem on a number field.

    Also, if you have 2 cartons, there wouldn't be a 0 in the field, there would be a 1, right?

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