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  

Open form and fill in a txt box



 
 
Thread Tools Display Modes
  #1  
Old March 13th, 2006, 04:43 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Open form and fill in a txt box

have a form that I created that is to add a new employee to our database.
We deal with insurance, so I want to be able to add a dependant to that
person's record. I have a form for new employee and a form for new dependent.
Once a person has filled in the new employee information, they should click
on a button that says add dependent. When the add dependent form opens, I
want the parent information to be automatically filled in.

For example, I have 2 tables: EmployeeInfo and DependentInfo. The
DependentInfo has a field called ParentSSN which is linked to the SSN
field in EmployeeInfo. When you add a new employee, you have to fill in SSN
in a txt box, and when you go to the add dependent form, I want the field
ParentSSN (its a txt box linked to the DpendentInfo table) to
be automatically filled in with the SSN from the new employee screen.

Can anyone help me with this?

Thank you!


  #2  
Old March 13th, 2006, 05:20 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Open form and fill in a txt box

Sara,
It would be much easier to make your Dependent form a subform of your
Employee form, not a separate form.
If the 2 tables are linked One to Many via the SSNs (an Employee can have
more than one dependent), and the Main Employee form is linked to the
Dependent subform (Parent/Child) via ParentSSN to DependentSSN, any
dependent records added to the dependent subform will automatically have the
ParentSSN filled in with the assocaited EmployeeSSN.
That's all handled by the table relationships, and the Parent/Child link
from the Main to the Subform.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions



"Sara" wrote in message
...
have a form that I created that is to add a new employee to our database.
We deal with insurance, so I want to be able to add a dependant to that
person's record. I have a form for new employee and a form for new
dependent.
Once a person has filled in the new employee information, they should
click
on a button that says add dependent. When the add dependent form opens, I
want the parent information to be automatically filled in.

For example, I have 2 tables: EmployeeInfo and DependentInfo. The
DependentInfo has a field called ParentSSN which is linked to the SSN
field in EmployeeInfo. When you add a new employee, you have to fill in
SSN
in a txt box, and when you go to the add dependent form, I want the field
ParentSSN (its a txt box linked to the DpendentInfo table) to
be automatically filled in with the SSN from the new employee screen.

Can anyone help me with this?

Thank you!




  #3  
Old March 13th, 2006, 05:21 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Open form and fill in a txt box

One way to do this would be to use the OpenArgs argument of the OpenForm
method to pass the SSN to the dependant form. Another would be to have the
dependant form refer to the Employee form for the information. The second
way will only work if the Employee form stays open while you are in the
dependant form.

My suggestion would be to use the OpenArgs way. Now, to make it
automatically fill the SSN field for the dependant table would be to use the
Default Value property of the SSN control on the dependant form. The trick
is, the Default Value can't use a variable, but it can use a formula. What I
would do is create a Static Function to hold the SSN. I would load the SSN
value from the OpenArgs in the form Load event, and set the Default Value
property to that function.

Here is a function that will do it:

Static Function GetSSN(Optional ByVal varNewSSN As Variant) As String
Dim varSSN As Variant

If Not IsMissing(varNewSSN) Then
varSSN = varNewSSN
End If
GetSSN = varSSN
End Function

When you open the dependant form:

DoCmd.OpenForm "frmDependant", , , , , , Me.txtSSN


In the Load event of your dependant form:

If Not IsNull(Me.OpenArgs) Then
GetSSn(Me.OpenArgs)
End If

The for the default value property of the SSN control on the dependant form

GetSSN()

"S
ara" wrote:

have a form that I created that is to add a new employee to our database.
We deal with insurance, so I want to be able to add a dependant to that
person's record. I have a form for new employee and a form for new dependent.
Once a person has filled in the new employee information, they should click
on a button that says add dependent. When the add dependent form opens, I
want the parent information to be automatically filled in.

For example, I have 2 tables: EmployeeInfo and DependentInfo. The
DependentInfo has a field called ParentSSN which is linked to the SSN
field in EmployeeInfo. When you add a new employee, you have to fill in SSN
in a txt box, and when you go to the add dependent form, I want the field
ParentSSN (its a txt box linked to the DpendentInfo table) to
be automatically filled in with the SSN from the new employee screen.

Can anyone help me with this?

Thank you!


  #4  
Old March 13th, 2006, 05:56 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Open form and fill in a txt box

Al's suggestion is really the best way to do it. My suggestion was
predicated on you having already set up your forms to behave like you want or
that you prefer separate forms.

"Al Camp" wrote:

Sara,
It would be much easier to make your Dependent form a subform of your
Employee form, not a separate form.
If the 2 tables are linked One to Many via the SSNs (an Employee can have
more than one dependent), and the Main Employee form is linked to the
Dependent subform (Parent/Child) via ParentSSN to DependentSSN, any
dependent records added to the dependent subform will automatically have the
ParentSSN filled in with the assocaited EmployeeSSN.
That's all handled by the table relationships, and the Parent/Child link
from the Main to the Subform.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions



"Sara" wrote in message
...
have a form that I created that is to add a new employee to our database.
We deal with insurance, so I want to be able to add a dependant to that
person's record. I have a form for new employee and a form for new
dependent.
Once a person has filled in the new employee information, they should
click
on a button that says add dependent. When the add dependent form opens, I
want the parent information to be automatically filled in.

For example, I have 2 tables: EmployeeInfo and DependentInfo. The
DependentInfo has a field called ParentSSN which is linked to the SSN
field in EmployeeInfo. When you add a new employee, you have to fill in
SSN
in a txt box, and when you go to the add dependent form, I want the field
ParentSSN (its a txt box linked to the DpendentInfo table) to
be automatically filled in with the SSN from the new employee screen.

Can anyone help me with this?

Thank you!





  #5  
Old March 13th, 2006, 06:07 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Open form and fill in a txt box

Being that I'm somewhat of a newbie to Access....how do I create a subform?

"Klatuu" wrote:

Al's suggestion is really the best way to do it. My suggestion was
predicated on you having already set up your forms to behave like you want or
that you prefer separate forms.

"Al Camp" wrote:

Sara,
It would be much easier to make your Dependent form a subform of your
Employee form, not a separate form.
If the 2 tables are linked One to Many via the SSNs (an Employee can have
more than one dependent), and the Main Employee form is linked to the
Dependent subform (Parent/Child) via ParentSSN to DependentSSN, any
dependent records added to the dependent subform will automatically have the
ParentSSN filled in with the assocaited EmployeeSSN.
That's all handled by the table relationships, and the Parent/Child link
from the Main to the Subform.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions



"Sara" wrote in message
...
have a form that I created that is to add a new employee to our database.
We deal with insurance, so I want to be able to add a dependant to that
person's record. I have a form for new employee and a form for new
dependent.
Once a person has filled in the new employee information, they should
click
on a button that says add dependent. When the add dependent form opens, I
want the parent information to be automatically filled in.

For example, I have 2 tables: EmployeeInfo and DependentInfo. The
DependentInfo has a field called ParentSSN which is linked to the SSN
field in EmployeeInfo. When you add a new employee, you have to fill in
SSN
in a txt box, and when you go to the add dependent form, I want the field
ParentSSN (its a txt box linked to the DpendentInfo table) to
be automatically filled in with the SSN from the new employee screen.

Can anyone help me with this?

Thank you!





  #6  
Old March 13th, 2006, 06:23 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Open form and fill in a txt box

Ok so I see how to create a subform. Is there a way to make NewEmployee form
on one tab and the NewDependent form on another tab and you can just switch
from one to the next by clicking on a tab?

"Sara" wrote:

Being that I'm somewhat of a newbie to Access....how do I create a subform?

"Klatuu" wrote:

Al's suggestion is really the best way to do it. My suggestion was
predicated on you having already set up your forms to behave like you want or
that you prefer separate forms.

"Al Camp" wrote:

Sara,
It would be much easier to make your Dependent form a subform of your
Employee form, not a separate form.
If the 2 tables are linked One to Many via the SSNs (an Employee can have
more than one dependent), and the Main Employee form is linked to the
Dependent subform (Parent/Child) via ParentSSN to DependentSSN, any
dependent records added to the dependent subform will automatically have the
ParentSSN filled in with the assocaited EmployeeSSN.
That's all handled by the table relationships, and the Parent/Child link
from the Main to the Subform.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions



"Sara" wrote in message
...
have a form that I created that is to add a new employee to our database.
We deal with insurance, so I want to be able to add a dependant to that
person's record. I have a form for new employee and a form for new
dependent.
Once a person has filled in the new employee information, they should
click
on a button that says add dependent. When the add dependent form opens, I
want the parent information to be automatically filled in.

For example, I have 2 tables: EmployeeInfo and DependentInfo. The
DependentInfo has a field called ParentSSN which is linked to the SSN
field in EmployeeInfo. When you add a new employee, you have to fill in
SSN
in a txt box, and when you go to the add dependent form, I want the field
ParentSSN (its a txt box linked to the DpendentInfo table) to
be automatically filled in with the SSN from the new employee screen.

Can anyone help me with this?

Thank you!





  #7  
Old March 13th, 2006, 06:31 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Open form and fill in a txt box

Ok I figured that out too, but how do you make one tab dependent on one
table, and the other tab dependent on another table?

"Sara" wrote:

Ok so I see how to create a subform. Is there a way to make NewEmployee form
on one tab and the NewDependent form on another tab and you can just switch
from one to the next by clicking on a tab?

"Sara" wrote:

Being that I'm somewhat of a newbie to Access....how do I create a subform?

"Klatuu" wrote:

Al's suggestion is really the best way to do it. My suggestion was
predicated on you having already set up your forms to behave like you want or
that you prefer separate forms.

"Al Camp" wrote:

Sara,
It would be much easier to make your Dependent form a subform of your
Employee form, not a separate form.
If the 2 tables are linked One to Many via the SSNs (an Employee can have
more than one dependent), and the Main Employee form is linked to the
Dependent subform (Parent/Child) via ParentSSN to DependentSSN, any
dependent records added to the dependent subform will automatically have the
ParentSSN filled in with the assocaited EmployeeSSN.
That's all handled by the table relationships, and the Parent/Child link
from the Main to the Subform.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions



"Sara" wrote in message
...
have a form that I created that is to add a new employee to our database.
We deal with insurance, so I want to be able to add a dependant to that
person's record. I have a form for new employee and a form for new
dependent.
Once a person has filled in the new employee information, they should
click
on a button that says add dependent. When the add dependent form opens, I
want the parent information to be automatically filled in.

For example, I have 2 tables: EmployeeInfo and DependentInfo. The
DependentInfo has a field called ParentSSN which is linked to the SSN
field in EmployeeInfo. When you add a new employee, you have to fill in
SSN
in a txt box, and when you go to the add dependent form, I want the field
ParentSSN (its a txt box linked to the DpendentInfo table) to
be automatically filled in with the SSN from the new employee screen.

Can anyone help me with this?

Thank you!





  #8  
Old March 13th, 2006, 06:40 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Open form and fill in a txt box

Nevermind....got it figured out. Man I'm on a roll today.

"Sara" wrote:

Ok I figured that out too, but how do you make one tab dependent on one
table, and the other tab dependent on another table?

"Sara" wrote:

Ok so I see how to create a subform. Is there a way to make NewEmployee form
on one tab and the NewDependent form on another tab and you can just switch
from one to the next by clicking on a tab?

"Sara" wrote:

Being that I'm somewhat of a newbie to Access....how do I create a subform?

"Klatuu" wrote:

Al's suggestion is really the best way to do it. My suggestion was
predicated on you having already set up your forms to behave like you want or
that you prefer separate forms.

"Al Camp" wrote:

Sara,
It would be much easier to make your Dependent form a subform of your
Employee form, not a separate form.
If the 2 tables are linked One to Many via the SSNs (an Employee can have
more than one dependent), and the Main Employee form is linked to the
Dependent subform (Parent/Child) via ParentSSN to DependentSSN, any
dependent records added to the dependent subform will automatically have the
ParentSSN filled in with the assocaited EmployeeSSN.
That's all handled by the table relationships, and the Parent/Child link
from the Main to the Subform.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions



"Sara" wrote in message
...
have a form that I created that is to add a new employee to our database.
We deal with insurance, so I want to be able to add a dependant to that
person's record. I have a form for new employee and a form for new
dependent.
Once a person has filled in the new employee information, they should
click
on a button that says add dependent. When the add dependent form opens, I
want the parent information to be automatically filled in.

For example, I have 2 tables: EmployeeInfo and DependentInfo. The
DependentInfo has a field called ParentSSN which is linked to the SSN
field in EmployeeInfo. When you add a new employee, you have to fill in
SSN
in a txt box, and when you go to the add dependent form, I want the field
ParentSSN (its a txt box linked to the DpendentInfo table) to
be automatically filled in with the SSN from the new employee screen.

Can anyone help me with this?

Thank you!





  #9  
Old December 17th, 2006, 03:36 AM posted to microsoft.public.access.forms
JustMe
external usenet poster
 
Posts: 96
Default Open form and fill in a txt box

This worked great for me, Klatuu!

Thanks!!
 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Customers- Contracts form problem GL Using Forms 10 February 7th, 2006 04:05 PM
Pulling data from values selected in dropdown list-values back to babs Using Forms 1 January 26th, 2006 07:40 PM
Open form in edit mode to add contents - but open by user last name JNariss New Users 1 December 14th, 2005 09:06 PM
Open new form command JB Using Forms 2 April 4th, 2005 09:38 PM
Closing Forms After Opening A Report Roger Lord Using Forms 2 February 26th, 2005 03:01 PM


All times are GMT +1. The time now is 10:35 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.