Unbound ComboBox Problem on Startup Switchboard

G

Guest

after much uphill skirmishes (for some unknown reason) i managed to drop an
unbound combobox onto my a2k (switchboard manager/wizard generated) startup
switchboard.

the RowSource depends upon the values of a 'Registration' table as follows:

SELECT [Registration].[Patient Number] FROM Registration;

and is ultimately supposed to allow me to use the chosen Patient 's number
in other forms the switchboard allows the user to open for data entry.

with that said, the problemo seems to be the form won't let the user select
a value. it scrolls through the Patient Numbers alright, but clicking on it
has no effect.

how come; am i trying to perform the undoable? what's up with that.

anyone have a clue they'd like to share?

-ted
 
J

Jeff Conrad

The Switchboard form the wizard creates sets the form's
Allow Edits property to "No." This makes selection of
a combo box (bound or unbound) impossible on the form.
Go to the form's Properties list and change Allow Edits
to "Yes" and then you will be able to select a value from
the combo box.
 
G

Guest

makes sense when you know what it's doing, doesn't it.

so i reset it to allow edits and it can be edited!

i'm running into a minor snafu when i try to create a boilerplate filter
that can be used on a designated subset of my forms which'd need it.

using the 'Apply Filter' action of the macro, i create a filter i name
'WhichPatient' with the where clause "[Forms]![Command and Control
Center]![SelectPatient]".

i drop this macro, i name 'GetPatient', into the "Filter" property of one of
my forms.

based on what i read, when the user opens the form and hits the 'Apply
Filter' button it should open to the patient whose number appearing in the
combo box, but instead i'm seeing a Parameter Query asking me to 'Enter
Value' of "GetPatient".

where did i turn on the wrong corner?

-ted


Jeff Conrad said:
The Switchboard form the wizard creates sets the form's
Allow Edits property to "No." This makes selection of
a combo box (bound or unbound) impossible on the form.
Go to the form's Properties list and change Allow Edits
to "Yes" and then you will be able to select a value from
the combo box.

--
Jeff Conrad
Access Junkie
Bend, Oregon

after much uphill skirmishes (for some unknown reason) i managed to drop an
unbound combobox onto my a2k (switchboard manager/wizard generated) startup
switchboard.

the RowSource depends upon the values of a 'Registration' table as follows:

SELECT [Registration].[Patient Number] FROM Registration;

and is ultimately supposed to allow me to use the chosen Patient 's number
in other forms the switchboard allows the user to open for data entry.

with that said, the problemo seems to be the form won't let the user select
a value. it scrolls through the Patient Numbers alright, but clicking on it
has no effect.

how come; am i trying to perform the undoable? what's up with that.

anyone have a clue they'd like to share?

-ted
 
J

Jeff Conrad

I'm a little confused by *exactly* what you want Ted, but I'll
take a swing at it. I believe you would like to select a patient
number from an unbound combo box on the Switchboard.
Then you wish to open a form from the Switchboard, hit the
Filter button and display records in this second form that match
the combo box selection. Correct??

I'm no macro expert by the way.

In my test scenario here I left my Switchboard name as "Switchboard."
I also created a test form called frmRegistrations that will by
default display all the records from the table called Registrations.
Using the Switchboard wizard I selected to open this form and
display all records.

1. My combo box on form Switchboard is called SelectPatient
with the following SQL as RowSource:

SELECT Registration.[Patient Number] FROM Registration;

2. My macro is called Macro1. In the ApplyFilter Action Arguments
I have the following:
Filter Name: <nothing, just blank>
Where Condition: [Registration]![Patient Number]=[Forms]![Switchboard]![SelectPatient]

What that does is tell the Filter to look for matching records in
the table Registration where the Patient Number matches the combo
box selection on the Switchboard form.

3. On frmRegistrations I put a command button on the form and
in the Click event I enter Macro1 on the Property line.

Save all changes.

4. I select a Patient Number from the combo box on the Switchboard.
I then click the button on the Switchboard that opens form frmRegistrations.
Once the form is open I click the command button and the form is
filtered with the Patent Number I selected on the Switchboard form.

Is that what you were looking for??

As an alternative you could ditch the macro entirely and just enter
this expression directly on the Filter Property of frmRegistrations:

[Registration]![Patient Number]=[Forms]![Switchboard]![SelectPatient]

Hope that helps,
--
Jeff Conrad
Access Junkie
Bend, Oregon

makes sense when you know what it's doing, doesn't it.

so i reset it to allow edits and it can be edited!

i'm running into a minor snafu when i try to create a boilerplate filter
that can be used on a designated subset of my forms which'd need it.

using the 'Apply Filter' action of the macro, i create a filter i name
'WhichPatient' with the where clause "[Forms]![Command and Control
Center]![SelectPatient]".

i drop this macro, i name 'GetPatient', into the "Filter" property of one of
my forms.

based on what i read, when the user opens the form and hits the 'Apply
Filter' button it should open to the patient whose number appearing in the
combo box, but instead i'm seeing a Parameter Query asking me to 'Enter
Value' of "GetPatient".

where did i turn on the wrong corner?

-ted


Jeff Conrad said:
The Switchboard form the wizard creates sets the form's
Allow Edits property to "No." This makes selection of
a combo box (bound or unbound) impossible on the form.
Go to the form's Properties list and change Allow Edits
to "Yes" and then you will be able to select a value from
the combo box.

--
Jeff Conrad
Access Junkie
Bend, Oregon

after much uphill skirmishes (for some unknown reason) i managed to drop an
unbound combobox onto my a2k (switchboard manager/wizard generated) startup
switchboard.

the RowSource depends upon the values of a 'Registration' table as follows:

SELECT [Registration].[Patient Number] FROM Registration;

and is ultimately supposed to allow me to use the chosen Patient 's number
in other forms the switchboard allows the user to open for data entry.

with that said, the problemo seems to be the form won't let the user select
a value. it scrolls through the Patient Numbers alright, but clicking on it
has no effect.

how come; am i trying to perform the undoable? what's up with that.

anyone have a clue they'd like to share?

-ted
 
G

Guest

hi jeff!!

i guess i left enough out of my feeble request to allow the demons of
ambiguity to do their dirty work :)

what i was trying to do indeed am trying to do is this jeff: the user always
registers a patient before that patient's number can be found in the unbound
control on the s'board. if a patient ain't registered, he ain't a gonna be in
the drop down list. that drop down list is there so that the user can tell
the app'n this is the patient number on whose forms i am going to be working
today---henceforth when i click a menu button and request that it take me to
'diagnostic tests' or 'physical examination' forms etc etc (each of which is
equipped with its own patient number control, then i don't want to scroll
through a litany of other patient numbers when all i want is the one that i
entered into the unbound combobox control on the switchboard. perhaps
there's a bit more melodrama here than i had intended, but you get the drift.
i think your game plan and mine are in synch until you got to item three
which has a command button existing on the registration form. the
registration form is filled in once an only once per patient. however, (you
could not have known this but) there are lots and lots of forms which don't
all get completed and/or re-edited at the same time -- they get completed
over a period of weeks and sometimes even months. so the user has no over
arching need to use the registration form. what i think i need is to have a
macro or some DoCmd.ApplyFilter code that contains your expression which is
actuated each time a user opens a form. in this way, although there may be
hundreds of other patients w/ 'physical examination' forms in the database,
when the user dials in patient number XXXXX or whatever, the user will be
presented with XXXXX's record.

-ted


Jeff Conrad said:
I'm a little confused by *exactly* what you want Ted, but I'll
take a swing at it. I believe you would like to select a patient
number from an unbound combo box on the Switchboard.
Then you wish to open a form from the Switchboard, hit the
Filter button and display records in this second form that match
the combo box selection. Correct??

I'm no macro expert by the way.

In my test scenario here I left my Switchboard name as "Switchboard."
I also created a test form called frmRegistrations that will by
default display all the records from the table called Registrations.
Using the Switchboard wizard I selected to open this form and
display all records.

1. My combo box on form Switchboard is called SelectPatient
with the following SQL as RowSource:

SELECT Registration.[Patient Number] FROM Registration;

2. My macro is called Macro1. In the ApplyFilter Action Arguments
I have the following:
Filter Name: <nothing, just blank>
Where Condition: [Registration]![Patient Number]=[Forms]![Switchboard]![SelectPatient]

What that does is tell the Filter to look for matching records in
the table Registration where the Patient Number matches the combo
box selection on the Switchboard form.

3. On frmRegistrations I put a command button on the form and
in the Click event I enter Macro1 on the Property line.

Save all changes.

4. I select a Patient Number from the combo box on the Switchboard.
I then click the button on the Switchboard that opens form frmRegistrations.
Once the form is open I click the command button and the form is
filtered with the Patent Number I selected on the Switchboard form.

Is that what you were looking for??

As an alternative you could ditch the macro entirely and just enter
this expression directly on the Filter Property of frmRegistrations:

[Registration]![Patient Number]=[Forms]![Switchboard]![SelectPatient]

Hope that helps,
--
Jeff Conrad
Access Junkie
Bend, Oregon

makes sense when you know what it's doing, doesn't it.

so i reset it to allow edits and it can be edited!

i'm running into a minor snafu when i try to create a boilerplate filter
that can be used on a designated subset of my forms which'd need it.

using the 'Apply Filter' action of the macro, i create a filter i name
'WhichPatient' with the where clause "[Forms]![Command and Control
Center]![SelectPatient]".

i drop this macro, i name 'GetPatient', into the "Filter" property of one of
my forms.

based on what i read, when the user opens the form and hits the 'Apply
Filter' button it should open to the patient whose number appearing in the
combo box, but instead i'm seeing a Parameter Query asking me to 'Enter
Value' of "GetPatient".

where did i turn on the wrong corner?

-ted


Jeff Conrad said:
The Switchboard form the wizard creates sets the form's
Allow Edits property to "No." This makes selection of
a combo box (bound or unbound) impossible on the form.
Go to the form's Properties list and change Allow Edits
to "Yes" and then you will be able to select a value from
the combo box.

--
Jeff Conrad
Access Junkie
Bend, Oregon


after much uphill skirmishes (for some unknown reason) i managed to drop an
unbound combobox onto my a2k (switchboard manager/wizard generated) startup
switchboard.

the RowSource depends upon the values of a 'Registration' table as follows:

SELECT [Registration].[Patient Number] FROM Registration;

and is ultimately supposed to allow me to use the chosen Patient 's number
in other forms the switchboard allows the user to open for data entry.

with that said, the problemo seems to be the form won't let the user select
a value. it scrolls through the Patient Numbers alright, but clicking on it
has no effect.

how come; am i trying to perform the undoable? what's up with that.

anyone have a clue they'd like to share?

-ted
 
J

Jeff Conrad

Hi Ted,

Ok, I think I have a clearer picture of what you would like to do.
I have some ideas in mind, but it will have to wait till tomorrow.
I will be quite busy the rest of the day.

For now just a couple of comments.
Using the Switchboard Manager for this could be quite tedious.
You might be better off building your own main switchboard-type
main form, but I will see what I can come up with.
Second, I would try and avoid using macros for any of this.
Macros are quite limited and do not have error handling.

I'll get back with you.
 
G

Guest

jeff,

just a heads up....

i changed the ApplyEdits property of the switchboard to 'Yes' so as to allow
me to edit/modify the combobox i set on it which allows the user to select a
'Patient Number' from a RowSource that uses a SQL query on the value of it in
the Registration table.

also, i added this
DoCmd.ApplyFilter , "Me.[Patient Number] = " & [Forms]![Command and Control
Center]![SelectPatient]

to the OnOpen property of a form (in this case, the 'Diagnostic' tests form).

and ..... it compiles but seems to not work.

hmmmmm?

-ted
 
J

Jeff Conrad

jeff,

just a heads up....

i changed the ApplyEdits property of the switchboard to 'Yes' so as to allow
me to edit/modify the combobox i set on it which allows the user to select a
'Patient Number' from a RowSource that uses a SQL query on the value of it in
the Registration table.

also, i added this
DoCmd.ApplyFilter , "Me.[Patient Number] = " & [Forms]![Command and Control
Center]![SelectPatient]

to the OnOpen property of a form (in this case, the 'Diagnostic' tests form).

and ..... it compiles but seems to not work.

hmmmmm?

Hi Ted,

There really are countless ways to handle this, but I will present just
one method. Feel free to experiment with other techniques.

Follow these directions on a backup.

Assumptions:
- Your Switchboard form created by the wizard is called
Command And Control Center
- The form you wish to open is called Diagnostic
- The table on which the combo box is based is called
Registration
- The combo box on the form is called SelectPatient with
a Rowsource of something like:
SELECT Registration.[Patient Number] FROM Registration;

1. Create a new saved query called qryFilter with the following SQL:
SELECT Registration.*
FROM Registration
WHERE ((([Registration]![Patient Number])=[Forms]![Command And Control Center]![SelectPatient]));

2. Create a new Standard Module called modOpenForms

3. Copy/paste the following code into that module:
'***********Code Start**********
Public Sub OpenDiagnostic()
On Error GoTo ErrorPoint

If IsNull(Forms![Command And Control Center]!SelectPatient) Then
MsgBox "Please select a Patient Number from " _
& "the list provided before continuing." _
, vbInformation, "Which Patient?"
Else
DoCmd.OpenForm "Diagnostic", , "qryFilter"
End If

ExitPoint:
Exit Sub

ErrorPoint:
' Unexpected Error
MsgBox "The following error has occurred:" _
& vbNewLine & "Error Number: " & Err.Number _
& vbNewLine & "Error Description: " & Err.Description _
, vbExclamation, "Unexpected Error"
Resume ExitPoint

End Sub
'***********Code Start**********

Why do we need the module?
It is necessary if you wish to continue using the Switchboard Manager
created form.

4. Compile the code, save, and close the module.

5. Launch the Switchboard Manager Wizard. To open the
Diagnostic form, instead of just using the "Open Form" option
you need to use the "Run Code" option. Select that and
then enter OpenDiagnostic in the Function Name area.
This tells the wizard that when the form option is pressed,
use the code we just created to open the form.

6. Close the wizard and then test. If no selection is made
in the combo box, then a message box is displayed and
the form does not open. If they choose a Patient Number
and then press the button on your main form, then the
Diagnostic form opens with a Filter applied that matches
the combo box selection. Clicking the Remove Filter
button on the Toolbar will show all the records if the
user decides to do that.

Hope that is what you are looking for. Make any
modifications to suit your desire.
 
G

Guest

hey jeff,

wrt assumptions....the combo box the user uses to choose which patient
number they want to work with (assuming that it's already been entered
previously through the registration form -- whether a minute or a year ago)
is on the command and control center and not (as i think you're assuming) on
the registration form. since you placed a reference to the select patient
combobox directly under the registration form i'm betting you think it to be
on the registration form and not on the command and control center form. am i
wrong?

-ted



Jeff Conrad said:
jeff,

just a heads up....

i changed the ApplyEdits property of the switchboard to 'Yes' so as to allow
me to edit/modify the combobox i set on it which allows the user to select a
'Patient Number' from a RowSource that uses a SQL query on the value of it in
the Registration table.

also, i added this
DoCmd.ApplyFilter , "Me.[Patient Number] = " & [Forms]![Command and Control
Center]![SelectPatient]

to the OnOpen property of a form (in this case, the 'Diagnostic' tests form).

and ..... it compiles but seems to not work.

hmmmmm?

Hi Ted,

There really are countless ways to handle this, but I will present just
one method. Feel free to experiment with other techniques.

Follow these directions on a backup.

Assumptions:
- Your Switchboard form created by the wizard is called
Command And Control Center
- The form you wish to open is called Diagnostic
- The table on which the combo box is based is called
Registration
- The combo box on the form is called SelectPatient with
a Rowsource of something like:
SELECT Registration.[Patient Number] FROM Registration;

1. Create a new saved query called qryFilter with the following SQL:
SELECT Registration.*
FROM Registration
WHERE ((([Registration]![Patient Number])=[Forms]![Command And Control Center]![SelectPatient]));

2. Create a new Standard Module called modOpenForms

3. Copy/paste the following code into that module:
'***********Code Start**********
Public Sub OpenDiagnostic()
On Error GoTo ErrorPoint

If IsNull(Forms![Command And Control Center]!SelectPatient) Then
MsgBox "Please select a Patient Number from " _
& "the list provided before continuing." _
, vbInformation, "Which Patient?"
Else
DoCmd.OpenForm "Diagnostic", , "qryFilter"
End If

ExitPoint:
Exit Sub

ErrorPoint:
' Unexpected Error
MsgBox "The following error has occurred:" _
& vbNewLine & "Error Number: " & Err.Number _
& vbNewLine & "Error Description: " & Err.Description _
, vbExclamation, "Unexpected Error"
Resume ExitPoint

End Sub
'***********Code Start**********

Why do we need the module?
It is necessary if you wish to continue using the Switchboard Manager
created form.

4. Compile the code, save, and close the module.

5. Launch the Switchboard Manager Wizard. To open the
Diagnostic form, instead of just using the "Open Form" option
you need to use the "Run Code" option. Select that and
then enter OpenDiagnostic in the Function Name area.
This tells the wizard that when the form option is pressed,
use the code we just created to open the form.

6. Close the wizard and then test. If no selection is made
in the combo box, then a message box is displayed and
the form does not open. If they choose a Patient Number
and then press the button on your main form, then the
Diagnostic form opens with a Filter applied that matches
the combo box selection. Clicking the Remove Filter
button on the Toolbar will show all the records if the
user decides to do that.

Hope that is what you are looking for. Make any
modifications to suit your desire.
 
G

Guest

hey jeff,

i didn't notice this aforehand, but in your step 5 you're assuming i haven't
already configured the switchboard wizard to use the open form option. [also,
my description must've led you to think that there's only one other form on
the menu so to speak, i.e. the 'diagnostic' tests one; this isn't
true....there are many and each would need to be opened w/ this filtered
patient number by the user.

isn't it somehow possible to use

Private Sub Form_Load()
DoCmd.ApplyFilter , "[Patient Number] = " & [Forms]![Command and Control
Center]![SelectPatient]
End Sub

jeff,

just a heads up....

i changed the ApplyEdits property of the switchboard to 'Yes' so as to allow
me to edit/modify the combobox i set on it which allows the user to select a
'Patient Number' from a RowSource that uses a SQL query on the value of it in
the Registration table.

also, i added this
DoCmd.ApplyFilter , "Me.[Patient Number] = " & [Forms]![Command and Control
Center]![SelectPatient]

to the OnOpen property of a form (in this case, the 'Diagnostic' tests form).

and ..... it compiles but seems to not work.

hmmmmm?

Hi Ted,

There really are countless ways to handle this, but I will present just
one method. Feel free to experiment with other techniques.

Follow these directions on a backup.

Assumptions:
- Your Switchboard form created by the wizard is called
Command And Control Center
- The form you wish to open is called Diagnostic
- The table on which the combo box is based is called
Registration
- The combo box on the form is called SelectPatient with
a Rowsource of something like:
SELECT Registration.[Patient Number] FROM Registration;

1. Create a new saved query called qryFilter with the following SQL:
SELECT Registration.*
FROM Registration
WHERE ((([Registration]![Patient Number])=[Forms]![Command And Control Center]![SelectPatient]));

2. Create a new Standard Module called modOpenForms

3. Copy/paste the following code into that module:
'***********Code Start**********
Public Sub OpenDiagnostic()
On Error GoTo ErrorPoint

If IsNull(Forms![Command And Control Center]!SelectPatient) Then
MsgBox "Please select a Patient Number from " _
& "the list provided before continuing." _
, vbInformation, "Which Patient?"
Else
DoCmd.OpenForm "Diagnostic", , "qryFilter"
End If

ExitPoint:
Exit Sub

ErrorPoint:
' Unexpected Error
MsgBox "The following error has occurred:" _
& vbNewLine & "Error Number: " & Err.Number _
& vbNewLine & "Error Description: " & Err.Description _
, vbExclamation, "Unexpected Error"
Resume ExitPoint

End Sub
'***********Code Start**********

Why do we need the module?
It is necessary if you wish to continue using the Switchboard Manager
created form.

4. Compile the code, save, and close the module.

5. Launch the Switchboard Manager Wizard. To open the
Diagnostic form, instead of just using the "Open Form" option
you need to use the "Run Code" option. Select that and
then enter OpenDiagnostic in the Function Name area.
This tells the wizard that when the form option is pressed,
use the code we just created to open the form.

6. Close the wizard and then test. If no selection is made
in the combo box, then a message box is displayed and
the form does not open. If they choose a Patient Number
and then press the button on your main form, then the
Diagnostic form opens with a Filter applied that matches
the combo box selection. Clicking the Remove Filter
button on the Toolbar will show all the records if the
user decides to do that.

Hope that is what you are looking for. Make any
modifications to suit your desire.
 
J

Jeff Conrad

Hi Ted,

Your assumptions about my assumptions are incorrect.
My combo box *IS* on the Command And Control Center form.
In my simple test I have that form (which was created by the
Switchboard Manager and I just renamed it) and one other
form called Diagnostic. The table is called Registration per
your very first post. Following my previous directions everything
works just fine.

You might also want to try my suggestion in your other thread
with Ken.
 
J

Jeff Conrad

See my reply in your other thread with Ken.

--
Jeff Conrad
Access Junkie
Bend, Oregon

hey jeff,

i didn't notice this aforehand, but in your step 5 you're assuming i haven't
already configured the switchboard wizard to use the open form option. [also,
my description must've led you to think that there's only one other form on
the menu so to speak, i.e. the 'diagnostic' tests one; this isn't
true....there are many and each would need to be opened w/ this filtered
patient number by the user.

isn't it somehow possible to use

Private Sub Form_Load()
DoCmd.ApplyFilter , "[Patient Number] = " & [Forms]![Command and Control
Center]![SelectPatient]
End Sub

jeff,

just a heads up....

i changed the ApplyEdits property of the switchboard to 'Yes' so as to allow
me to edit/modify the combobox i set on it which allows the user to select a
'Patient Number' from a RowSource that uses a SQL query on the value of it in
the Registration table.

also, i added this
DoCmd.ApplyFilter , "Me.[Patient Number] = " & [Forms]![Command and Control
Center]![SelectPatient]

to the OnOpen property of a form (in this case, the 'Diagnostic' tests form).

and ..... it compiles but seems to not work.

hmmmmm?

Hi Ted,

There really are countless ways to handle this, but I will present just
one method. Feel free to experiment with other techniques.

Follow these directions on a backup.

Assumptions:
- Your Switchboard form created by the wizard is called
Command And Control Center
- The form you wish to open is called Diagnostic
- The table on which the combo box is based is called
Registration
- The combo box on the form is called SelectPatient with
a Rowsource of something like:
SELECT Registration.[Patient Number] FROM Registration;

1. Create a new saved query called qryFilter with the following SQL:
SELECT Registration.*
FROM Registration
WHERE ((([Registration]![Patient Number])=[Forms]![Command And Control Center]![SelectPatient]));

2. Create a new Standard Module called modOpenForms

3. Copy/paste the following code into that module:
'***********Code Start**********
Public Sub OpenDiagnostic()
On Error GoTo ErrorPoint

If IsNull(Forms![Command And Control Center]!SelectPatient) Then
MsgBox "Please select a Patient Number from " _
& "the list provided before continuing." _
, vbInformation, "Which Patient?"
Else
DoCmd.OpenForm "Diagnostic", , "qryFilter"
End If

ExitPoint:
Exit Sub

ErrorPoint:
' Unexpected Error
MsgBox "The following error has occurred:" _
& vbNewLine & "Error Number: " & Err.Number _
& vbNewLine & "Error Description: " & Err.Description _
, vbExclamation, "Unexpected Error"
Resume ExitPoint

End Sub
'***********Code Start**********

Why do we need the module?
It is necessary if you wish to continue using the Switchboard Manager
created form.

4. Compile the code, save, and close the module.

5. Launch the Switchboard Manager Wizard. To open the
Diagnostic form, instead of just using the "Open Form" option
you need to use the "Run Code" option. Select that and
then enter OpenDiagnostic in the Function Name area.
This tells the wizard that when the form option is pressed,
use the code we just created to open the form.

6. Close the wizard and then test. If no selection is made
in the combo box, then a message box is displayed and
the form does not open. If they choose a Patient Number
and then press the button on your main form, then the
Diagnostic form opens with a Filter applied that matches
the combo box selection. Clicking the Remove Filter
button on the Toolbar will show all the records if the
user decides to do that.

Hope that is what you are looking for. Make any
modifications to suit your desire.
 
G

Guest

Ok.

Jeff Conrad said:
See my reply in your other thread with Ken.

--
Jeff Conrad
Access Junkie
Bend, Oregon

hey jeff,

i didn't notice this aforehand, but in your step 5 you're assuming i haven't
already configured the switchboard wizard to use the open form option. [also,
my description must've led you to think that there's only one other form on
the menu so to speak, i.e. the 'diagnostic' tests one; this isn't
true....there are many and each would need to be opened w/ this filtered
patient number by the user.

isn't it somehow possible to use

Private Sub Form_Load()
DoCmd.ApplyFilter , "[Patient Number] = " & [Forms]![Command and Control
Center]![SelectPatient]
End Sub

jeff,

just a heads up....

i changed the ApplyEdits property of the switchboard to 'Yes' so as to allow
me to edit/modify the combobox i set on it which allows the user to select a
'Patient Number' from a RowSource that uses a SQL query on the value of it in
the Registration table.

also, i added this
DoCmd.ApplyFilter , "Me.[Patient Number] = " & [Forms]![Command and Control
Center]![SelectPatient]

to the OnOpen property of a form (in this case, the 'Diagnostic' tests form).

and ..... it compiles but seems to not work.

hmmmmm?

Hi Ted,

There really are countless ways to handle this, but I will present just
one method. Feel free to experiment with other techniques.

Follow these directions on a backup.

Assumptions:
- Your Switchboard form created by the wizard is called
Command And Control Center
- The form you wish to open is called Diagnostic
- The table on which the combo box is based is called
Registration
- The combo box on the form is called SelectPatient with
a Rowsource of something like:
SELECT Registration.[Patient Number] FROM Registration;

1. Create a new saved query called qryFilter with the following SQL:
SELECT Registration.*
FROM Registration
WHERE ((([Registration]![Patient Number])=[Forms]![Command And Control Center]![SelectPatient]));

2. Create a new Standard Module called modOpenForms

3. Copy/paste the following code into that module:
'***********Code Start**********
Public Sub OpenDiagnostic()
On Error GoTo ErrorPoint

If IsNull(Forms![Command And Control Center]!SelectPatient) Then
MsgBox "Please select a Patient Number from " _
& "the list provided before continuing." _
, vbInformation, "Which Patient?"
Else
DoCmd.OpenForm "Diagnostic", , "qryFilter"
End If

ExitPoint:
Exit Sub

ErrorPoint:
' Unexpected Error
MsgBox "The following error has occurred:" _
& vbNewLine & "Error Number: " & Err.Number _
& vbNewLine & "Error Description: " & Err.Description _
, vbExclamation, "Unexpected Error"
Resume ExitPoint

End Sub
'***********Code Start**********

Why do we need the module?
It is necessary if you wish to continue using the Switchboard Manager
created form.

4. Compile the code, save, and close the module.

5. Launch the Switchboard Manager Wizard. To open the
Diagnostic form, instead of just using the "Open Form" option
you need to use the "Run Code" option. Select that and
then enter OpenDiagnostic in the Function Name area.
This tells the wizard that when the form option is pressed,
use the code we just created to open the form.

6. Close the wizard and then test. If no selection is made
in the combo box, then a message box is displayed and
the form does not open. If they choose a Patient Number
and then press the button on your main form, then the
Diagnostic form opens with a Filter applied that matches
the combo box selection. Clicking the Remove Filter
button on the Toolbar will show all the records if the
user decides to do that.

Hope that is what you are looking for. Make any
modifications to suit your desire.
 

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