|
-
Aug 8th, 2005, 04:27 AM
#1
Thread Starter
Member
[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
-
Aug 8th, 2005, 05:59 AM
#2
Hyperactive Member
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..
Anu..
The Difference between a Successful person and others is not a Lack of Knowledge,
But rather a Lack of WILL 
-
Aug 9th, 2005, 08:44 PM
#3
Thread Starter
Member
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
-
Aug 10th, 2005, 10:56 PM
#4
Thread Starter
Member
Re: combo box - please help
Thanks.. I solved the problem on my own.
-
Aug 12th, 2005, 02:48 AM
#5
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|