[RESOLVED] combo box - please help
Hi,
I am using the following VBA code but it is giving me a Type Mismatch error on the line marked below.
Private Sub Combo0_AfterUpdate()
Dim sql As String
Dim rst As Recordset
sql = "Select * from MailboxCats where MailboxName= '" & Me.Combo0.Value & "'"
Set rst = CurrentDb.OpenRecordset(sql) <--------- TYPE MISMATCH ERROR
'extract the sub category field
While Not rst.EOF
Combo2.AddItem rst.Fields(1) 'I am extracting the second field
rst.MoveNext
Wend
End Sub
Please help. Thanks
Re: combo box - please help
Hi...
I thnk mail box name field is not a text field...it might be a numeric field...
u need to remove the single quote ( ' ) in the sql statement
VB Code:
sql = "Select * from MailboxCats where MailboxName= " & Me.Combo0.Value & ""
Try it...it definetly works...
All the best.. :thumb:
Anu..
Re: combo box - please help
Anu, unfortunately mailboxname is a text field. Removing the single quote gives a different error that no records were found in query SQL.
Any other ideas? Thanks
Re: combo box - please help
Thanks.. I solved the problem on my own.
Re: [RESOLVED] combo box - please help
Could u please tell me whats the problem is....