PC Review


Reply
Thread Tools Rate Thread

DAO Parameter Type Mismatch

 
 
=?Utf-8?B?RE1jMjAwNA==?=
Guest
Posts: n/a
 
      31st Jan 2007
Hi

Can anybody help me with regards to the error I get from this code.

Run-time error '13':

Type mismatch

Why does this appear.

Regards

D

Sub DatabaseTest()

Dim dbsLinksdata As Database
Dim qryDepartments As QueryDef
Dim prmDepartment As Parameter

Set dbsLinksdata = OpenDatabase("C:\LinksSystem\LinksStore.mdb")

Set qryDepartments = dbsLinksdata.CreateQueryDef("", "PARAMETERS
strdepartment Text; SELECT * FROM chooser_DivisionsAndDepartments WHERE
DivisionName = [strDepartment]")

Set prmDepartment = qryDepartments.Parameters!strdepartment <<< Error
appears here

ChangeTheParameters qryDepartments, prmDepartment, "Central IT"

'dbsLinksdata.OpenRecordset (qryDepartments)

End Sub

Sub ChangeTheParameters(qryTemp As QueryDef, prmDepartment As Parameter,
strdepartment As String)

Dim rstTempSet As Recordset
Dim fldName As Field

prmDepartment = strdepartment

Set rstTempSet = qryDepartments.OpenRecordset(dbForwardOnly)

Debug.Print "Department " & strdepartment

Do While Not rstTempSet.EOF

For Each fldName In rstTempSet.Fields
Debug.Print " - " & fldName.Name & " = " & flname;
Next fldName

Debug.Print

rstTempSet.MoveNext

Loop

rstTempSet.Close

End Sub
 
Reply With Quote
 
 
 
 
merjet
Guest
Posts: n/a
 
      31st Jan 2007
This worked for me.

Sub MyQuery()
Dim db As Database
Dim qdf As QueryDef

Set db = OpenDatabase("c:\temp\db1.mdb")
Set qdf = db.QueryDefs("Query1")
qdf.Parameters("[Div]") = "Pants"
Set rst = qdf.OpenRecordset()
Debug.Print rst("Div")
End Sub

Hth,
Merjet

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Type Mismatch: array or user defined type expected =?Utf-8?B?RXhjZWxNb25rZXk=?= Microsoft Excel Programming 4 6th Jul 2006 03:40 PM
Type Mismatch Error in showModalDialog Parameter sarithsutha@gmail.com Microsoft Dot NET Framework 1 5th Jun 2006 08:02 AM
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Microsoft Excel Programming 1 31st Oct 2005 08:20 PM
Sudden "Type Mismatch" Error with querydef parameter Mike Thomas Microsoft Access Form Coding 4 3rd Jun 2004 06:04 PM
Type mismatch error (different than previous type mismatch?) Roberta Microsoft Access VBA Modules 3 9th Jan 2004 06:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:42 PM.