A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Sub form validations



 
 
Thread Tools Display Modes
  #1  
Old April 28th, 2010, 07:53 PM posted to microsoft.public.access.forms
SteveG
external usenet poster
 
Posts: 36
Default Sub form validations

Hi All:
I am pretty new to this stuff, but need to figure out how control data flow
in a form with a bunch of tabbed sub forms. I will try to see if I can make
this make sense:
We have a foirm with a bunch of tabbed sub forms used for dataentry. We need
to control thins so that if someone enters data in a field of one of the sub
forms, they cannot exit the form without clicking the save button and
therefor cannot click on another tab in the master form until the data is
saved. For instance, tab a calls for first name and last name. Once data is
entered into either field, the user cannot click on tab b which would be for
credit limit until the data in tab a has been saved.

Hope this post makes some sense to someone

TIF

--
SteveG
  #2  
Old April 28th, 2010, 07:59 PM posted to microsoft.public.access.forms
Daryl S[_2_]
external usenet poster
 
Posts: 881
Default Sub form validations

SteveG -

You can make the other tabs invisible while data is incomplete. If you want
to progress logically from tab 1 to tab 2, etc., then you can start with all
tabs invisible other than tab 1. Then when the user hits the Save button and
data is valid, then you can make tab 2 visible (and hide tab 1 if you want).
Or you can start with all tabs visible, but on any change to a field you can
make the other tabs invisible until the Save button is pressed and data
validated.


--
Daryl S


"SteveG" wrote:

Hi All:
I am pretty new to this stuff, but need to figure out how control data flow
in a form with a bunch of tabbed sub forms. I will try to see if I can make
this make sense:
We have a foirm with a bunch of tabbed sub forms used for dataentry. We need
to control thins so that if someone enters data in a field of one of the sub
forms, they cannot exit the form without clicking the save button and
therefor cannot click on another tab in the master form until the data is
saved. For instance, tab a calls for first name and last name. Once data is
entered into either field, the user cannot click on tab b which would be for
credit limit until the data in tab a has been saved.

Hope this post makes some sense to someone

TIF

--
SteveG

  #3  
Old April 28th, 2010, 08:56 PM posted to microsoft.public.access.forms
SteveG
external usenet poster
 
Posts: 36
Default Sub form validations

Thanks Daryl...option 2 would seem to fit better with this project...I kmow
how to make the fields in the sub form invisible, but how would I make them
disappear when a field in one of the sub forms becomes dirty?
--
SteveG


"Daryl S" wrote:

SteveG -

You can make the other tabs invisible while data is incomplete. If you want
to progress logically from tab 1 to tab 2, etc., then you can start with all
tabs invisible other than tab 1. Then when the user hits the Save button and
data is valid, then you can make tab 2 visible (and hide tab 1 if you want).
Or you can start with all tabs visible, but on any change to a field you can
make the other tabs invisible until the Save button is pressed and data
validated.


--
Daryl S


"SteveG" wrote:

Hi All:
I am pretty new to this stuff, but need to figure out how control data flow
in a form with a bunch of tabbed sub forms. I will try to see if I can make
this make sense:
We have a foirm with a bunch of tabbed sub forms used for dataentry. We need
to control thins so that if someone enters data in a field of one of the sub
forms, they cannot exit the form without clicking the save button and
therefor cannot click on another tab in the master form until the data is
saved. For instance, tab a calls for first name and last name. Once data is
entered into either field, the user cannot click on tab b which would be for
credit limit until the data in tab a has been saved.

Hope this post makes some sense to someone

TIF

--
SteveG

  #4  
Old April 29th, 2010, 02:49 PM posted to microsoft.public.access.forms
Daryl S[_2_]
external usenet poster
 
Posts: 881
Default Sub form validations

Steve -

I suspect you would want to make the tabs invisible rather than all the
fields on the tabs or subforms. The code would look something like this
(from the main form):
Me.Page1.Visible = True

You may want to write a form subroutine (in the main form) to manage which
tabs are visible or not. A lot depends on how many conditions would warrant
a change to the viewable tabs, and what logic may be involved. Your function
could accept one parameter that indicates which tab should be visible, and
the code would then set all the other tabs' .visible property to false. Pass
in a specific value to allow all tabs to be visible. Here is a sample, but
use your tab names rather than Page1, Page2, etc.:

Public Sub ShowHideTabs(TabName As String)

Select Case TabName
Case "All"
Me.Page1.Visible = True
Me.Page2.Visible = True
Me.Page3.Visible = True
Case "1"
Me.Page1.Visible = True
Me.Page2.Visible = False
Me.Page3.Visible = False
Case "2"
Me.Page1.Visible = False
Me.Page2.Visible = True
Me.Page3.Visible = False
Case "3"
Me.Page1.Visible = False
Me.Page2.Visible = False
Me.Page3.Visible = True
Case Else
MsgBox "Page " & TabName & " not coded for in ShowHideTabs Subroutine."
Me.Page7.Visible = True
Me.Page8.Visible = True
End Select
End Sub

Then you could simply call this function from any field's On Dirty event.
You could call it from the 'Save Button' to allow all tabs to be visible
after it passed validation. Then if there were any other conditions that
came to light, you would just code a call into this one procedure. The call
to the routine from any tab would be:

ShowHideTabs ("7") 'pass in current page name

--
Daryl S


"SteveG" wrote:

Thanks Daryl...option 2 would seem to fit better with this project...I kmow
how to make the fields in the sub form invisible, but how would I make them
disappear when a field in one of the sub forms becomes dirty?
--
SteveG


"Daryl S" wrote:

SteveG -

You can make the other tabs invisible while data is incomplete. If you want
to progress logically from tab 1 to tab 2, etc., then you can start with all
tabs invisible other than tab 1. Then when the user hits the Save button and
data is valid, then you can make tab 2 visible (and hide tab 1 if you want).
Or you can start with all tabs visible, but on any change to a field you can
make the other tabs invisible until the Save button is pressed and data
validated.


--
Daryl S


"SteveG" wrote:

Hi All:
I am pretty new to this stuff, but need to figure out how control data flow
in a form with a bunch of tabbed sub forms. I will try to see if I can make
this make sense:
We have a foirm with a bunch of tabbed sub forms used for dataentry. We need
to control thins so that if someone enters data in a field of one of the sub
forms, they cannot exit the form without clicking the save button and
therefor cannot click on another tab in the master form until the data is
saved. For instance, tab a calls for first name and last name. Once data is
entered into either field, the user cannot click on tab b which would be for
credit limit until the data in tab a has been saved.

Hope this post makes some sense to someone

TIF

--
SteveG

  #5  
Old April 29th, 2010, 09:19 PM posted to microsoft.public.access.forms
SteveG
external usenet poster
 
Posts: 36
Default Sub form validations

Thank You Daryl, you have been most helpful


--
SteveG


"Daryl S" wrote:

Steve -

I suspect you would want to make the tabs invisible rather than all the
fields on the tabs or subforms. The code would look something like this
(from the main form):
Me.Page1.Visible = True

You may want to write a form subroutine (in the main form) to manage which
tabs are visible or not. A lot depends on how many conditions would warrant
a change to the viewable tabs, and what logic may be involved. Your function
could accept one parameter that indicates which tab should be visible, and
the code would then set all the other tabs' .visible property to false. Pass
in a specific value to allow all tabs to be visible. Here is a sample, but
use your tab names rather than Page1, Page2, etc.:

Public Sub ShowHideTabs(TabName As String)

Select Case TabName
Case "All"
Me.Page1.Visible = True
Me.Page2.Visible = True
Me.Page3.Visible = True
Case "1"
Me.Page1.Visible = True
Me.Page2.Visible = False
Me.Page3.Visible = False
Case "2"
Me.Page1.Visible = False
Me.Page2.Visible = True
Me.Page3.Visible = False
Case "3"
Me.Page1.Visible = False
Me.Page2.Visible = False
Me.Page3.Visible = True
Case Else
MsgBox "Page " & TabName & " not coded for in ShowHideTabs Subroutine."
Me.Page7.Visible = True
Me.Page8.Visible = True
End Select
End Sub

Then you could simply call this function from any field's On Dirty event.
You could call it from the 'Save Button' to allow all tabs to be visible
after it passed validation. Then if there were any other conditions that
came to light, you would just code a call into this one procedure. The call
to the routine from any tab would be:

ShowHideTabs ("7") 'pass in current page name

--
Daryl S


"SteveG" wrote:

Thanks Daryl...option 2 would seem to fit better with this project...I kmow
how to make the fields in the sub form invisible, but how would I make them
disappear when a field in one of the sub forms becomes dirty?
--
SteveG


"Daryl S" wrote:

SteveG -

You can make the other tabs invisible while data is incomplete. If you want
to progress logically from tab 1 to tab 2, etc., then you can start with all
tabs invisible other than tab 1. Then when the user hits the Save button and
data is valid, then you can make tab 2 visible (and hide tab 1 if you want).
Or you can start with all tabs visible, but on any change to a field you can
make the other tabs invisible until the Save button is pressed and data
validated.


--
Daryl S


"SteveG" wrote:

Hi All:
I am pretty new to this stuff, but need to figure out how control data flow
in a form with a bunch of tabbed sub forms. I will try to see if I can make
this make sense:
We have a foirm with a bunch of tabbed sub forms used for dataentry. We need
to control thins so that if someone enters data in a field of one of the sub
forms, they cannot exit the form without clicking the save button and
therefor cannot click on another tab in the master form until the data is
saved. For instance, tab a calls for first name and last name. Once data is
entered into either field, the user cannot click on tab b which would be for
credit limit until the data in tab a has been saved.

Hope this post makes some sense to someone

TIF

--
SteveG

 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:58 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.