Results 1 to 2 of 2

Thread: passing a variable

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Location
    belfast
    Posts
    1

    Unhappy

    when converting SQL in as command text in the record source in VB, is it possible to pass a variable ste up at design time?

  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    It is you want to create a dynamic SQL statement at runtime?
    If yes, the it should be able to archieve it. like below:
    Code:
    Dim MyCriteria As String
    Dim SQL As String
    Dim Db As DAO.Database
    Dim Rs As DAO.Recordset
    
    SQl = "SELECT * FROM TblName WHERE Field1='" & MyCriteria & "' ORDER BY Field1 ASC;"
    Set Rs = Db.OpenRecordset(SQL,dnOpenSnapshot)



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