Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to find out what the query type using VBA?

Status
Not open for further replies.

Alibaba2003

Programmer
Mar 31, 2003
67
US
I am listing all of the queries that I have in my database.
I am trying to distinguish action queries from select queries. I am listing the queries without a problem and append them to a table. I just dont know how to list the Query type as well. Here is my code .. Thanks

For Each obj In dbs.AllQueries
lenOfTableName = Len(obj.NAME)

'If left(obj.NAME, 1) = "@" Then
r0.AddNew
r0!QueryName = obj.FullName
R0!QUERYTYPE = '' WHAT DO I WRITE HERE?????


r0.Update
'End If

Next obj


It's Nice to Be Important But It's more Important to BE Nice
 
From VB Help, Type Property Example:


Code:
Sub TypeX3()

    Dim dbsNorthwind As Database
    Dim qdfLoop As QueryDef

    Set dbsNorthwind = OpenDatabase("Northwind.mdb")

    Debug.Print "QueryDefs in Northwind Database:"
    Debug.Print "  Type - Name"

    ' Enumerate QueryDefs collection of Northwind database.
    For Each qdfLoop In dbsNorthwind.QueryDefs
        Debug.Print "    " & _
            QueryDefType(qdfLoop.Type) & " - " & qdfLoop.Name
    Next qdfLoop

    dbsNorthwind.Close

End Sub

Function QueryDefType(intType As Integer) As String

    Select Case intType
        Case dbQSelect
            QueryDefType = "dbQSelect"
        Case dbQAction
            QueryDefType = "dbQAction"
        Case dbQCrosstab
            QueryDefType = "dbQCrosstab"
        Case dbQDelete
            QueryDefType = "dbQDelete"
        Case dbQUpdate
            QueryDefType = "dbQUpdate"
        Case dbQAppend
            QueryDefType = "dbQAppend"
        Case dbQMakeTable
            QueryDefType = "dbQMakeTable"
        Case dbQDDL
            QueryDefType = "dbQDDL"
        Case dbQSQLPassThrough
            QueryDefType = "dbQSQLPassThrough"
        Case dbQSetOperation
            QueryDefType = "dbQSetOperation"
        Case dbQSPTBulk
            QueryDefType = "dbQSPTBulk"
    End Select

End Function


TomCologne
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top