how to create a query to handle "No Such Data Found"

F

Fuzuy

I try to create an interface to display records/ or posting message on
a form when I select data from a table which meet the combo box
values to diaplay on a form, however, sometime data of combination of
two combo boxes are not exist..

how should I do so that when it has data it displays the data on a
Form, while no criteria meets then it posts a message "No Such Data
Found" and be also direct back to combo boxes menu.

Thanks in advance for your help..
 
F

fredg

I try to create an interface to display records/ or posting message on
a form when I select data from a table which meet the combo box
values to diaplay on a form, however, sometime data of combination of
two combo boxes are not exist..

how should I do so that when it has data it displays the data on a
Form, while no criteria meets then it posts a message "No Such Data
Found" and be also direct back to combo boxes menu.

Thanks in advance for your help..

The form that displays the data is the form with the combo box?
Code the form's Load event:

If Me.RecordsetClone.RecordCount = 0 then
MsgBox "No Records Found"
Me.ComboName.SetFocus
End If
 
C

Carl Rapson

Fuzuy said:
I try to create an interface to display records/ or posting message on
a form when I select data from a table which meet the combo box
values to diaplay on a form, however, sometime data of combination of
two combo boxes are not exist..

how should I do so that when it has data it displays the data on a
Form, while no criteria meets then it posts a message "No Such Data
Found" and be also direct back to combo boxes menu.

Thanks in advance for your help..

Before applying the combo box selections to your form's Record Source, you
could execute a query that checks to see if there are any records that
match. This could be done in the combo box's AfterUpdate event. If there are
no records, show a Messagebox and return to the combo box. If there are
records, apply the selection and load your form's records.

Carl Rapson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top