PC Review


Reply
Thread Tools Rate Thread

Conditional forms

 
 
Frank
Guest
Posts: n/a
 
      3rd Aug 2008
I am a beginning Access user. I have both 2003 and 2007 versions. I
want to create a database where depending on the item selected in a
dropdown list or checkbox, the user is navigated to a different form
which is specific to that selection. In other words, if a patient has
a pacemaker procedure the next form would ask for information specific
to that procedure as opposed to another procedure. I have read 2
books and none of them cover this type of programming.
Any help would be greatly appreciated.
Frank
 
Reply With Quote
 
 
 
 
Alex Dybenko
Guest
Posts: n/a
 
      3rd Aug 2008
Hi,
perhaps you need something like a wizard? Then look here:
http://www.vb123.com/toolshed/00_Docs/buildwizards.htm

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com

"Frank" <(E-Mail Removed)> wrote in message
news:03c5e21b-99f3-4c6c-996f-(E-Mail Removed)...
>I am a beginning Access user. I have both 2003 and 2007 versions. I
> want to create a database where depending on the item selected in a
> dropdown list or checkbox, the user is navigated to a different form
> which is specific to that selection. In other words, if a patient has
> a pacemaker procedure the next form would ask for information specific
> to that procedure as opposed to another procedure. I have read 2
> books and none of them cover this type of programming.
> Any help would be greatly appreciated.
> Frank


 
Reply With Quote
 
Chris O''''Neill
Guest
Posts: n/a
 
      5th Aug 2008
You can use a combo box to load a form by having the rowsource of the combo
box point to a table that contains the list of procedures and forms you want
to load. For instance, it might look like this:

Table tblProcedureForms:

FieldName Description
---------------------------------------------------
SystemID AutoNumber field (primary key)
Procedure The procedure the person had
FormName Name of the form for that procedure

You then create a form called frmPickProcedure that has the following
controls:

1. A combo box (cboProcedure) that queries the tblProcedureForms table
using this SQL string:

SELECT tblProcedureForms.SystemID, tblProcedureForms.Procedure,
tblProcedureForms.FormName
FROM tblProcedureForms
ORDER BY tblProcedureForms.Procedure;

The second column (tblProcedureForms.Procedures) is the bound column and is
also the only column shown in the combo box (column widths = 0";2.1042";0")

2. A "Cancel" button so the user can close the form if they change their mind

3. An "OK" command button that has the following code in it's OnClick event:

******** Begin Code ************
Private Sub cmdOK_Click

Dim strFormName as String
Dim strProcedureName as String

' Grab the procedure that the user selected
strProcedureName = Me.cboProcedure

' If the user clicks OK without picking a procedure
' send them back
If IsNull(strProcedureName) Then
prompt = "You must select a procedure"
style = vbOKOnly + vbCritical
title = "No procedure selected!"
MsgBox prompt, style, title
Me.cboProcedure.SetFocus
Else
' The user has selected a procedure
' Load that form
strFormName = Me.cboAvailableReports.Column(2)
DoCmd.OpenForm strFormName
End If

End Sub
******** Begin Code ************

(Note: I have not included error handling for the sake of brevity. As
well, you can add other things to this, like closing the form after the
procedure form has loaded.)

This all may sound very complicated, but it really isn't. It shouldn't take
long to create the table and form. You could also create another form to
manage the tblProcedures table (i.e. if you want to add, delete or edit a
procedure). Then, it's just a matter of building the various forms for all
the procedures.

Btw, the above will become somewhat unmanageable if you have alot of
procedures, mainly because of the number of procedure forms you'll have to
design. It might be possible to create a generic procedure form that's
populated with different controls (text boxes, etc.) depending on the
procedure selected by the user. In that case, you'd use a design similar to
the above, but would load one form and use the table to contain the controls
to populate that form with. However, doing that is beyond my current skill
level.

Hope this has helped, or at least gotten you thinking about how you can do it.

Regards, Chris

"Frank" wrote:

> I am a beginning Access user. I have both 2003 and 2007 versions. I
> want to create a database where depending on the item selected in a
> dropdown list or checkbox, the user is navigated to a different form
> which is specific to that selection. In other words, if a patient has
> a pacemaker procedure the next form would ask for information specific
> to that procedure as opposed to another procedure. I have read 2
> books and none of them cover this type of programming.
> Any help would be greatly appreciated.
> Frank
>

 
Reply With Quote
 
Frank
Guest
Posts: n/a
 
      6th Aug 2008
On Aug 5, 2:40*am, Chris O''''Neill
<ChrisONe...@discussions.microsoft.com> wrote:
> You can use a combo box to load a form by having the rowsource of the combo
> box point to a table that contains the list ofproceduresand forms you want
> to load. *For instance, it might look like this:
>
> Table tblProcedureForms:
>
> FieldName * * * * Description
> ---------------------------------------------------
> SystemID * * * * *AutoNumber field (primary key)
> Procedure * * * * The procedure the person had
> FormName * * * *Name of the form for that procedure
>
> You then create a form called frmPickProcedure that has the following
> controls:
>
> 1. *A combo box (cboProcedure) that queries the tblProcedureForms table
> using this SQL string:
>
> SELECT tblProcedureForms.SystemID, tblProcedureForms.Procedure,
> tblProcedureForms.FormName
> FROM tblProcedureForms
> ORDER BY tblProcedureForms.Procedure;
>
> The second column (tblProcedureForms.Procedures) is the bound column and is
> also the only column shown in the combo box (column widths = 0";2.1042";0")
>
> 2. *A "Cancel" button so the user can close the form if they change their mind
>
> 3. *An "OK" command button that has the following code in it's OnClick event:
>
> ******** Begin Code ************
> Private Sub cmdOK_Click
>
> * * Dim strFormName as String
> * * Dim strProcedureName as String
>
> * * ' Grab the procedure that the user selected
> * * strProcedureName = Me.cboProcedure
>
> * * ' If the user clicks OK without picking a procedure
> * * ' send them back
> * * If IsNull(strProcedureName) Then
> * * * * prompt = "You must select a procedure"
> * * * * style = vbOKOnly + vbCritical
> * * * * title = "No procedure selected!"
> * * * * MsgBox prompt, style, title
> * * * * Me.cboProcedure.SetFocus
> * * Else
> * * * * ' The user has selected a procedure
> * * * * ' Load that form
> * * * * strFormName = Me.cboAvailableReports.Column(2)
> * * * * DoCmd.OpenForm strFormName
> * * End If
>
> End Sub
> ******** Begin Code ************
>
> (Note: *I have not included error handling for the sake of brevity. *As
> well, you can add other things to this, like closing the form after the
> procedure form has loaded.)
>
> This all may sound very complicated, but it really isn't. *It shouldn'ttake
> long to create the table and form. *You could also create another form to
> manage the tblProcedures table (i.e. if you want to add, delete or edit a
> procedure). *Then, it's just a matter of building the various forms forall
> theprocedures.
>
> Btw, the above will become somewhat unmanageable if you have alot ofprocedures, mainly because of the number of procedure forms you'll have to
> design. *It might be possible to create a generic procedure form that's
> populated with different controls (text boxes, etc.) depending on the
> procedure selected by the user. *In that case, you'd use a design similar to
> the above, but would load one form and use the table to contain the controls
> to populate that form with. *However, doing that is beyond my current skill
> level.
>
> Hope this has helped, or at least gotten you thinking about how you can do it.
>
> Regards, *Chris
>
>
>
> "Frank" wrote:
> > I am a beginning Access user. *I have both 2003 and 2007 versions. *I
> > want to create a database where depending on the item selected in a
> > dropdown list or checkbox, the user is navigated to a different form
> > which is specific to that selection. *In other words, if apatienthas
> > a pacemaker procedure the next form would ask for information specific
> > to that procedure as opposed to another procedure. *I have read 2
> > books and none of them cover this type of programming.
> > Any help would be greatly appreciated.
> > Frank- Hide quoted text -

>
> - Show quoted text -


Thank you. That was very helpful. A little over my head but I'm a
quick learner!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional Formatting in Forms Judy Microsoft Access Form Coding 0 14th Dec 2009 08:50 PM
Conditional forms authentication ajitgoel@gmail.com Microsoft ASP .NET 1 4th Apr 2007 07:48 PM
Re: Conditional Formatting Between Sub-Forms Peter Hibbs Microsoft Access 0 22nd Jan 2007 10:29 PM
Conditional formatting forms =?Utf-8?B?a2x0aW5v?= Microsoft Access 1 19th Nov 2006 01:15 AM
Forms and Conditional Formatting =?Utf-8?B?bGltaXRlZCBjb21wdXRlciBrbm93bGVkZ2U=?= Microsoft Excel Worksheet Functions 2 29th Apr 2005 04:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:55 PM.