Run-time error 13 Type mismatch

wrightie

Registered User.
Local time
Today, 11:59
Joined
Jun 11, 2009
Messages
22
Hi,

I'm hoping someone can help. I'm pretty sure I've missed or done something silly here.

When I use the code below I get the message "Run-time error 13 type mismatch" . I'm not sure if it has anything to do with it being a numerical field or not. Any help is much appreciated.

The second where line seems to be where the problem lies.

Wrightie

Code:
Private Sub cmdOK_Click()
Dim db As DAO.Database
Dim QD As QueryDef
Dim where As Variant
Set db = CurrentDb()
On Error Resume Next
db.QueryDefs.Delete ("Qry_By_Period_Entered")
On Error GoTo 0
where = Null
where = where & " AND [PeriodEntered]=" + Me![Period_Combo]
Set QD = db.CreateQueryDef("Qry_By_Period_Entered", _
"Select * FROM Qry_By_Ccy " & (" where " + Mid(where, 6) & ";"))
DoCmd.OpenReport "Premium_By_Period", acViewPreview, , , acWindowNormal
End Sub
 
Managed to sort it. Apologies if I wasted anyones time.

I changed the query section to below and now works fine.

Code:
Set QD = db.CreateQueryDef("Qry_By_Period_Entered", _
"Select * FROM Qry_By_Ccy where [PeriodEntered]= " & [Period_Combo] & ";")

wrightie
 

Users who are viewing this thread

Back
Top Bottom