Results 1 to 4 of 4

Thread: VB6 and MS access

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2004
    Posts
    6

    VB6 and MS access

    Hallo,

    I have a little problem to update an access data base.
    Writing new records into the db is no problem.

    The code for my update button is the following

    Private Sub cmdUpdate_Click()
    If txtBonnr.Text <> vbNullString And txtBonnr.Text <> "" Then
    MsgBox "Updaten"


    openDB

    Set RECSET = CreateObject("ADODB.Recordset")
    RECSET.Open "UPDATE eetfestijn SET Subtotaal = '& txtAantal.Text &' WHERE Bonnr=" & CDbl(txtBonnr.Text), DBCON
    DBCON.Close

    End If

    End Sub

    If i execute the button i receive a runtime error 80040e07
    microsoft odbc microsoft access driver
    data type mismatch in criteria expression

  2. #2
    Frenzied Member David.Poundall's Avatar
    Join Date
    Sep 2002
    Location
    Robin Hood Land
    Posts
    1,457
    Try

    VB Code:
    1. RECSET.Open "UPDATE eetfestijn SET Subtotaal = '" & txtAantal.Text & "' WHERE Bonnr=" & CDbl(txtBonnr.Text), DBCON
    David

    Learn the Rules so that you know how to break them properly.

    Printing dll dBTools MZTools Winsock API WinsockVB More Winsock SGrid2 MSChart Mail2Web

    If you have found this thread useful then read this

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2004
    Posts
    6
    Hallo ,

    It is not working ,but i have find another solution.

    this works :

    Call openDB
    Dim UpdateTaskRecord As String
    UpdateTaskRecord = "UPDATE eetfestijn SET Steak1='" & txtAantal & "' WHERE Bonnr='" & txtBonnr & "'"
    DBCON.Execute UpdateTaskRecord
    MsgBox "Eetfestijn updated"

    Thanks a lot for replying me
    Geert

  4. #4
    Frenzied Member David.Poundall's Avatar
    Join Date
    Sep 2002
    Location
    Robin Hood Land
    Posts
    1,457
    LOL - yes, I missed the parenthasis on the last bit. Glad its OK.
    David

    Learn the Rules so that you know how to break them properly.

    Printing dll dBTools MZTools Winsock API WinsockVB More Winsock SGrid2 MSChart Mail2Web

    If you have found this thread useful then read this

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