DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 11 of 11

Thread: Execute dont work with vb6 and access 2000, why?

  1. #1
    Join Date
    Feb 2010
    Posts
    5

    Question Execute dont work with vb6 and access 2000, why?

    Hi all, im accessing access 2000 with dao 3.6 and vb 6.0 sp4, im not using data control, and i dont want to use it.

    I open the database with...

    Set ws_PDF = DBEngine.Workspaces(0)
    Set BASE_PDF = ws_PDF.OpenDatabase(RUTA_PDF)


    Base open perfectly and can use select sql to read without problems, the problems are when i use insert, delete or update, the execute command do nothing.

    Something like...

    sql = "DELETE FROM PERSONAS WHERE codigopersona=" & codigoRP & " and CodigoC=1 and NumeroC=1 and CodigoD=1"

    BASE_PDF.Execute sql


    Execute, no error, but nothing happens, if i open the database in access, open the table, and access to the table, vb6 report the problem is locked (with select), when use execute (inser, delete etc), nothing happens.

    I really need help with that, i cant find a solution.

    Help me please.

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    Are you sure you have records in the database that meet this critieria?
    Code:
    WHERE codigopersona=" & codigoRP & " and CodigoC=1 and NumeroC=1 and CodigoD=1"

  3. #3
    Join Date
    Feb 2010
    Posts
    5
    Yes, ofcourse.

    The problem isnt only with delete instruccion is with insert and update, data isnt deleted, inserted or updated.

    Execute dont do nothing, and no error is reported.

  4. #4
    Join Date
    Jun 2009
    Posts
    135

  5. #5
    Join Date
    Feb 2010
    Posts
    5
    Im on sp6b.

  6. #6
    Join Date
    Mar 2009
    Location
    Italy - Breganze (VI)
    Posts
    120
    Missing asterisk:

    Code:
    sql = "DELETE * FROM PERSONAS "
    ssql = ssql & " WHERE codigopersona=" & codigoRP 
    ssql = ssql & " and CodigoC=1 and NumeroC=1 and CodigoD=1"

  7. #7
    Join Date
    Feb 2010
    Posts
    5
    I changed to ado, and all start to work, can understand why, but now is working.

  8. #8
    Join Date
    Jun 2009
    Posts
    135
    That is not what you originally said/wrote...

    >Hi all, im accessing access 2000 with dao 3.6 and vb 6.0 sp4...

    Now, after that I had to look up some old code...
    Code:
    Dim daoWs00 As DAO.Workspace
    Dim daoDb00 As DAO.Database
    Dim daoRs00 As DAO.Recordset
    
    Set daoWs00 = DBEngine.Workspaces(0)
    Set daoDb00 = daoWs00.OpenDatabase("F:\Temp.mdb", , False)
    daoDb00.Execute "delete from tbltest where iid > 1"
    and I'm betting since you did not supply this parameter you are opening it as read only (note: above works with dao 3.6 on vista home)



    Good Luck

  9. #9
    Join Date
    Feb 2010
    Posts
    5
    Yes, is working now with the false parameter.

    Thank u very much.


    Maybe a offtopic with this thread but im getting a trouble now with numeric values.

    I got a form text field, the database uses double and integer, to solve the , decimal problem im using replace to change the , for . , is this correct?

    And another one, the database got a yes/no value, have to insert boolean values or just 0 , 1?

    Thanks again.

  10. #10
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    Quote Originally Posted by leko View Post
    I got a form text field, the database uses double and integer, to solve the , decimal problem im using replace to change the , for . , is this correct?
    I don't understand this question.
    Quote Originally Posted by leko
    And another one, the database got a yes/no value, have to insert boolean values or just 0 , 1?
    0 or 1 should be just fine.

  11. #11
    Join Date
    Nov 2003
    Location
    Alameda, CA
    Posts
    1,737
    Quote Originally Posted by leko View Post
    ... I got a form text field, the database uses double and integer, to solve the , decimal problem im using replace to change the , for . , is this correct?
    Use CDbl to convert the text of the textbox into a double. CDbl is 'internationally aware" and therefore it will convert the string using the current decimal separator. Then convert back the double into a string using the Str function, that uses only the . (dot) as separator:

    dim d as double
    d = cdbl(myTextBox.Text)
    sql = "select * from ... where mycolumn = " & Str(d)

    In this way the code will work in any language
    "There are two ways to write error-free programs. Only the third one works."
    Unknown

Similar Threads

  1. Converting Access 97 to 2000 via VB6?
    By syme321 in forum VB Classic
    Replies: 1
    Last Post: 03-04-2005, 10:09 AM
  2. Moving from Access 97 to Access 2000 with VB6
    By Dean Earley in forum VB Classic
    Replies: 2
    Last Post: 05-31-2002, 07:39 PM
  3. Using Access 2000 mdb files in VB5 or VB6?
    By Tim in forum VB Classic
    Replies: 2
    Last Post: 11-30-2000, 10:45 AM
  4. VB6 and Access 2000
    By toby in forum VB Classic
    Replies: 2
    Last Post: 05-26-2000, 05:36 PM
  5. Access 2000 automation from VB6
    By Mak Foka in forum authorevents.kurata
    Replies: 3
    Last Post: 04-18-2000, 08:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center