Multiple combo boxes on form to open another form

S

Sophia

I would like some advise on what to do with my situation. I have a form
Frm_LkkpAnimals that is based on a query with parameters to choose a date
range to display records. I am trying to put the parameters on another form
(named FrmLkkpPSbyDate) to make it more user friendly. I followed
instructions on how to use a pop up calendar to populate the cboStartDate and
cboEndDate boxes, but I can't get it to open the form with the date range and
the parameter box opens for each parameter before the input form is opened.

These dates are used in the record source for the Frm_LkkpAnimals
Between [Forms]![FrmLkkpPSbyDate]![cboStartDate] And
[Forms]![FrmLkkpPSbyDate]![cboEndDate]



Private Sub Form_Load()
'Set public variable to true to indicate that the report
'is in the Open event
bInReportOpenEvent = True

'Open form
DoCmd.OpenForm "FrmLkkpPSbyDate", , , , , acDialog
'Cancel Report if User Clicked the Cancel Button
If IsLoaded("FrmLkkpPSbyDate") = False Then Cancel = True

'Set public variable to false to indicate that the
'Open event is completed
bInReportOpenEvent = False
End Sub

Is there a simplier way to accomplish this? Also, can I use a combo box to
specify the date range as well as another criteria in the query?

Help would be greatly appreciated.
Sophia
 
M

Mer

What manual are you using to learn about form creation ? I am looking for a
good resource.

Thanks Mer
 
V

Van T. Dinh

I assume the code you posted is from Frm_LkkpAnimals???

In that case, it it too late as Access will try to obtain the data even
before the Form_Open Event fires, i.e. well before the Form_Load Event and
thus it will as for the Paramenters' values (since FrmLkkpPSbyDate is not
yet opened).

What you need to do is to open the Form FrmLkkpPSbyDate first for the user
to enter the Parameters' values. In this Form, create a CommandButton to
open the Form Frm_LkkpAnimals.

You may want to check that all entered (parameter) values are valid before
actually opening the Form Frm_LkkpAnimals. You can perform the validation
before the OpenForm Method in the Click Event of the CommandButton .

ComboBox: Yes but I am not sure whether this is simpler than Calendar
Controls. How do you propose to populate the ComboBox with date ranges?

Basically, ComboBox has the Value Property (same as TextBox) and if you can
use TextBoxes, you can use ComboBoxes. With ComboBox, you need to think
about populating the list. (I guess with TextBox, you also need to think
about validating what the user enters).
 
S

Sophia

Thank you Van for your help,
:> I assume the code you posted is from Frm_LkkpAnimals???
Yes, that is code from Frm_LkkpAnimals.

I did what you suggested, the user opens the FrmLkkpPSbyDate first for the
user
to enter the Parameters' values. Then I created a CommandButton to
open the form Frm_LkkpAnimals. It works PERFECTLY! Thank you!! I can't
believe that I have been working for days on trying to get this to work!

I am populating the combo boxes with the calendar dates based on code. I
followed a "Pop Up Calendar" instruction that I found on the web.

The reason I asked about entering different criteria for different combo
boxes, was that I read somewhere that you could only specifiy one criteria to
open a form. I thought that might be the reason that my form was not
working.

Mer: You asked what manual I am using.... I am using many different
sources. I have many, many books on Access (purchased from retail book
stores, such as Indigo) and then I search the forums for posts that describe
my problem. I can't say that I recommend any one book. If anyone else has a
favourite resource, I'd be very interested too.
Thanks, Sophia

Van T. Dinh said:
I assume the code you posted is from Frm_LkkpAnimals???

In that case, it it too late as Access will try to obtain the data even
before the Form_Open Event fires, i.e. well before the Form_Load Event and
thus it will as for the Paramenters' values (since FrmLkkpPSbyDate is not
yet opened).

What you need to do is to open the Form FrmLkkpPSbyDate first for the user
to enter the Parameters' values. In this Form, create a CommandButton to
open the Form Frm_LkkpAnimals.

You may want to check that all entered (parameter) values are valid before
actually opening the Form Frm_LkkpAnimals. You can perform the validation
before the OpenForm Method in the Click Event of the CommandButton .

ComboBox: Yes but I am not sure whether this is simpler than Calendar
Controls. How do you propose to populate the ComboBox with date ranges?

Basically, ComboBox has the Value Property (same as TextBox) and if you can
use TextBoxes, you can use ComboBoxes. With ComboBox, you need to think
about populating the list. (I guess with TextBox, you also need to think
about validating what the user enters).

--
HTH
Van T. Dinh
MVP (Access)



Sophia said:
I would like some advise on what to do with my situation. I have a form
Frm_LkkpAnimals that is based on a query with parameters to choose a date
range to display records. I am trying to put the parameters on another
form
(named FrmLkkpPSbyDate) to make it more user friendly. I followed
instructions on how to use a pop up calendar to populate the cboStartDate
and
cboEndDate boxes, but I can't get it to open the form with the date range
and
the parameter box opens for each parameter before the input form is
opened.

These dates are used in the record source for the Frm_LkkpAnimals
Between [Forms]![FrmLkkpPSbyDate]![cboStartDate] And
[Forms]![FrmLkkpPSbyDate]![cboEndDate]



Private Sub Form_Load()
'Set public variable to true to indicate that the report
'is in the Open event
bInReportOpenEvent = True

'Open form
DoCmd.OpenForm "FrmLkkpPSbyDate", , , , , acDialog
'Cancel Report if User Clicked the Cancel Button
If IsLoaded("FrmLkkpPSbyDate") = False Then Cancel = True

'Set public variable to false to indicate that the
'Open event is completed
bInReportOpenEvent = False
End Sub

Is there a simplier way to accomplish this? Also, can I use a combo box
to
specify the date range as well as another criteria in the query?

Help would be greatly appreciated.
Sophia
 
V

Van T. Dinh

I don't have one particular book I recommend but see:

http://home.bendbroadband.com/conradsystems/accessjunkie/resources.html#Books

Generally, I find books by John Viescas, Roger Jennings and the Access
Developer's Handbook are very useful. Roger Jennings has moved away from
Access (I think) so I am not sure whether he wrote any book on later Access
versions.

Of course, there is a huge mount of info. on Microsoft Web site but this
needs a bit of navigational skills.
 

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