Results 1 to 3 of 3

Thread: Houston!! I have a problem :(

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2003
    Posts
    3

    Houston!! I have a problem :(

    Can anyone help me with this code?

    I have a button in a form and when I press this button I want a messagebox showing me the value from a vield in a specific table.

    Dim db As Database
    Dim qdf As QueryDef
    Dim strSQL As String

    strSQL = "SELECT BANKSALDO FROM BANKEN WHERE BANKNAAM = '" & BANKID.Value & "';"

    Set db = CurrentDb
    Set qdf = db.CreateQueryDef("test1", strSQL)
    MsgBox (qdf("BANKSALDO"))

    It's now in the sub and it doesn't work :'(
    Do I have to put it in a function? I prefear it in the sub of the button.

    Thx a lot for u help

    GAME OVER!!

  2. #2
    Hyperactive Member
    Join Date
    Mar 2002
    Posts
    424
    VB Code:
    1. dim dBase as DataBase
    2. dim RecSet as Recordset
    3.  
    4. set dBase = currentDB
    5. set RecSet = dBase.OpenRecordset ("SELECT BANKSALDO FROM BANKEN WHERE BANKNAAM = '" & BANKID.Value & "';", dbOpenDynaset)
    6.  
    7. if RecSet.RecordCount <>0 then msgbox Recset!BANKSALDO

    Try someting like that.

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2003
    Posts
    3
    thx m8

    GAME OVER!!

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