By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,400 Members | 1,322 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,400 IT Pros & Developers. It's quick & easy.

How to tell if there is no selection in a DataCombo box?

P: n/a
I'm using a datacombo box in an application.

It works fine when someone has made a selction and I use:
adodcClient.Recordset.Bookmark = dcClient.SelectedItem
MsgBox "Client Selected: " & dcClient.SelectedItem
client = adodcClient.Recordset.Fields(0).Value
clientID = adodcClient.Recordset.Fields(1).Value

When there is no client, the code generates an error as should.

I am trying to trap this error and handle it. I have gone through the
help and can't figure this out.

When I do this, I get the message without the index, which makes me
the the index IS NULL"
MsgBox "Selected Client = " & dc.SelectedItem

Then I try this:
If adodcOrders.Recordset.Index Is Null Then
MsgBox "Please select a client"
End If

I get:
Compile Error:
Type Mismatch
When I look at the code after the error, "Index" is highlighted in:
adodcOrders.Recordset.Index

Would someone please explain to me how to determine if a selection has
been made in the dataCombo please.

Thanks very much in advance.

Dec 11 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Sun, 11 Dec 2005 01:44:21 GMT, Bookreader <bo***********@yahoo.com>
wrote:
I'm using a datacombo box in an application.

It works fine when someone has made a selction and I use:
adodcClient.Recordset.Bookmark = dcClient.SelectedItem
MsgBox "Client Selected: " & dcClient.SelectedItem
client = adodcClient.Recordset.Fields(0).Value
clientID = adodcClient.Recordset.Fields(1).Value

When there is no client, the code generates an error as should.

I am trying to trap this error and handle it. I have gone through the
help and can't figure this out.

When I do this, I get the message without the index, which makes me
the the index IS NULL"
MsgBox "Selected Client = " & dc.SelectedItem

Then I try this:
If adodcOrders.Recordset.Index Is Null Then
MsgBox "Please select a client"
End If

I get:
Compile Error:
Type Mismatch
When I look at the code after the error, "Index" is highlighted in:
adodcOrders.Recordset.Index

Would someone please explain to me how to determine if a selection has
been made in the dataCombo please.

Thanks very much in advance.

I meant to post this in the VB groups sorry.

Of course, I will appreciate any answers in this group as well.
Dec 11 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.