Results 1 to 2 of 2

Thread: why do i get an 'invalid use of property' out of this...

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    7
    Dim db As Database
    Dim rs As Recordset
    Dim qdf As QueryDef
    Dim strSQL As String

    strSQL = "INSERT into table1 SELECT FROM table2 WHERE field = '" & variable & "' "

    Set db = OpenDatabase(App.Path & "\database.mdb")

    Set qdf = db.CreateQueryDef("")
    Set qdf.SQL = strSQL

    Set rs = qdf.OpenRecordset(dbOpenSnapshot)

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    You cannot create a Recordset based on an action query. You can do something like this:
    Code:
    Private Sub Command1_Click()
        Dim db As Database
        Dim strSQL As String
    
        strSQL = "INSERT into table1 SELECT FROM table2 WHERE field = '" & variable & "' "
    
        Set db = OpenDatabase(App.Path & "\database.mdb")
        db.Execute strSQL, dbFailOnError
    End Sub

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