Results 1 to 5 of 5

Thread: This is really weird!!!!

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    39

    Exclamation

    Hi,

    I dunno what is wrong with this problem. I wrote a simple VB Program accessing to Access 97 database. This problem only happen if i save the table fields with an empty textbox field(I set the fields to Allow Zero Length to True)I use Microsoft Jet for the connection string. Below is my coding..

    Set DBConnect = New ADODB.Connection
    With DBConnect
    .CursorLocation = adUseServer
    .ConnectionString = cntstring
    .Open
    End With
    With rsTest
    .Open "CompanyProfile", DBConnect, adOpenDynamic, adLockOptimistic
    .AddNew
    .Fields("cst_City") = Text1.Text
    .Fields("cst_State") = Text1.Text
    .Update
    .Close
    End With

    When I run through this code, an error will occur displaying "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.". I change the cursor location to adUserClient and everthing works fine! If I don't change my cursorlocation, using adUseServer... i change the coding to ......
    .Fields("cst_City") = Text1.Text & ""
    .Fields("cst_State") = Text1.Text & ""
    It will save the information!! This is really weird.. and making me crazy..

    Anyone has any ideas... please advice.

    Thanks..

    Thomas


    [Edited by tomtan on 11-23-2000 at 12:15 AM]
    ThOmaS TaN

  2. #2
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    On Error Resume Next?

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    39
    Hi da_silvy,
    > On Error Resume Next?

    Well.. it will stop the error from displaying but it will not save the information to database.
    ThOmaS TaN

  4. #4
    Addicted Member LAURENS's Avatar
    Join Date
    Jan 2000
    Location
    Utrecht, the Netherlands
    Posts
    138

    Thumbs up You did the right thing

    Actually, what you did (concatenating "" to your string) is the right thing to do. A zero length string is not the same as an empty field. Allow zerolength makes access allow zero length strings (like "").

    Regards,
    Laurens

    Using VB5 Enterprise edition SP3
    VB6 Enterprise edition SP5

  5. #5

    Thread Starter
    Member
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    39
    But I think the problem is related to the Provider. Because I change from Microsoft Jet provider to an ODBC Data Source and it works fine..

    Anyone ever have this kinda problems before?

    Thanks.
    ThOmaS TaN

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