Create xtab query by form ??

L

luanhoxung

Hi, folks !
I use a unbound form to create a Xtab query by a command button.
Althought the query is created as my intention, I get error message
from the system "run-time error '13' - type missmatch".
Anyone help me explain this ?
All helps are appreciated.
Luan.

Here is the code:

Private Sub Command13_Click()
Dim Db As Database
Dim strSQL As String
Dim qrf As QueryDefs

strSQL = "TRANSFORM '~' & Last([TLICHTAU.TIME]) & '~' &
Last([TCUOCTAU.F40FT]) & '~' & Last([TCUOCTAU.F20FT]) AS state" & _
" SELECT THANGTAU.HANGTAU, THANGTAU.TEN, TLICHTAU.ETD" & _
" FROM (THANGTAU INNER JOIN (TCUOCTAU INNER JOIN TPORT ON
TCUOCTAU.PORT = TPORT.id) ON THANGTAU.HANGTAU = TCUOCTAU.HTAU) INNER
JOIN TLICHTAU ON (TPORT.id = TLICHTAU.PORT) AND (THANGTAU.HANGTAU =
TLICHTAU.HTAU)" & _
" WHERE (((THANGTAU.HANGTAU) Like '" & Me.line1 & "')" _
& " And ((TPORT.PORT) Like '" & Me.port1 & "')" _
& " GROUP BY THANGTAU.HANGTAU, THANGTAU.TEN, TLICHTAU.ETD" & _
" ORDER BY THANGTAU.HANGTAU" & " PIVOT TPORT.port;"

Set Db = CurrentDb
Db.QueryDefs.Delete "q1"
Set qrf = Db.CreateQueryDef("q1", strSQL) <-- ERROR !

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top