PC Review


Reply
Thread Tools Rate Thread

Default Value for field in Table

 
 
=?Utf-8?B?S2FyaW4=?=
Guest
Posts: n/a
 
      16th Jul 2007
Hi, I have two tables "Client" and "Projects" that are related by ID number.
In the Client table there is a field named "TaxForm".

In the Projects table, I have a field named "TaxDeptNotified", which is a
text field. Normally I would create a combo box on a form to select the
answer from a table that contains the values: Yes, No, NA.

Is it possible to have the Project\TaxDeptNotified field default to a
certain value (NA)based on the value in the Client\TaxForm field? (If the
Client Form is NOT a 990, the Answer s/b NA.)

TIA!
 
Reply With Quote
 
 
 
 
Jason Lopez
Guest
Posts: n/a
 
      16th Jul 2007
I have actually tried something similar (but with not much success, so this
could help us both out). There is some code that you might be able to enter
that is a SELECT CASE statement where that "TaxDeptNotified" field will be
filled if the condition required is met in the case statement (anyone
correct me if I am wrong). As long as it is on the same form, you should be
okay by using something like this (again, someone correct me as I have not
had much success with the SELECT CASE statement yet):

If Me!TaxForm = (what ever the value is) Then
Me!TaxDeptNotified = "Yes"
ElseIf Me!TaxForm = (Whatever secondary value should be) Then
Me!TaxDeptNotified = "No"
Else
Me!TaxDeptNotified = "N/A"
End If

If someone can translate this into a SELECT CASE statement, that might help
Karin out better.

Where it can help me out is if someone can help me point my statement to the
mainform from a subform. Essentially, the AfterUpdate event will trigger
the code and force data from the subform to the mainform if the conditions
are met.

Jason Lopez

"Karin" <(E-Mail Removed)> wrote in message
news:EAF7665E-0BFF-483A-A3E7-(E-Mail Removed)...
> Hi, I have two tables "Client" and "Projects" that are related by ID
> number.
> In the Client table there is a field named "TaxForm".
>
> In the Projects table, I have a field named "TaxDeptNotified", which is a
> text field. Normally I would create a combo box on a form to select the
> answer from a table that contains the values: Yes, No, NA.
>
> Is it possible to have the Project\TaxDeptNotified field default to a
> certain value (NA)based on the value in the Client\TaxForm field? (If the
> Client Form is NOT a 990, the Answer s/b NA.)
>
> TIA!



 
Reply With Quote
 
=?Utf-8?B?S2FyaW4=?=
Guest
Posts: n/a
 
      16th Jul 2007
Additionally - I could use a form to accomplish the request below. I have a
main form from Table Client and a Subform from Table Projects, both of which
include the fields I talk about below.

"Karin" wrote:

> Hi, I have two tables "Client" and "Projects" that are related by ID number.
> In the Client table there is a field named "TaxForm".
>
> In the Projects table, I have a field named "TaxDeptNotified", which is a
> text field. Normally I would create a combo box on a form to select the
> answer from a table that contains the values: Yes, No, NA.
>
> Is it possible to have the Project\TaxDeptNotified field default to a
> certain value (NA)based on the value in the Client\TaxForm field? (If the
> Client Form is NOT a 990, the Answer s/b NA.)
>
> TIA!

 
Reply With Quote
 
louisjohnphillips@gmail.com
Guest
Posts: n/a
 
      16th Jul 2007
On Jul 16, 7:08 am, Karin <Ka...@discussions.microsoft.com> wrote:
> Additionally - I could use a form to accomplish the request below. I have a
> main form from Table Client and a Subform from Table Projects, both of which
> include the fields I talk about below.
>
>
>
> "Karin" wrote:
> > Hi, I have two tables "Client" and "Projects" that are related by ID number.
> > In the Client table there is a field named "TaxForm".

>
> > In the Projects table, I have a field named "TaxDeptNotified", which is a
> > text field. Normally I would create a combo box on a form to select the
> > answer from a table that contains the values: Yes, No, NA.

>
> > Is it possible to have the Project\TaxDeptNotified field default to a
> > certain value (NA)based on the value in the Client\TaxForm field? (If the
> > Client Form is NOT a 990, the Answer s/b NA.)

>
> > TIA! - Hide quoted text -

>
> - Show quoted text -


Let's assume that the Clients and Projects tables have a master/detail
relationship. The frmClients is the main form and the frmProjectsSub
is a subform. These forms are linked based on ClientID.

Navigation to a new Clients row causes a new set of Projects rows to
appear. This has triggered the "on current" event in the
frmProjectsSub.

In the frmProjectsSub's "Form_Current" event handler, try

Private Sub Form_Current()
if Parent.ClientID.value = "999" then
Me.TaxDeptNotified.defaultvalue = NULL
else
Me.TaxDeptNotified.defaultvalue = "NA"
end if
end sub


 
Reply With Quote
 
louisjohnphillips@gmail.com
Guest
Posts: n/a
 
      16th Jul 2007
On Jul 16, 7:08 am, Karin <Ka...@discussions.microsoft.com> wrote:
> Additionally - I could use a form to accomplish the request below. I have a
> main form from Table Client and a Subform from Table Projects, both of which
> include the fields I talk about below.
>
>
>
> "Karin" wrote:
> > Hi, I have two tables "Client" and "Projects" that are related by ID number.
> > In the Client table there is a field named "TaxForm".

>
> > In the Projects table, I have a field named "TaxDeptNotified", which is a
> > text field. Normally I would create a combo box on a form to select the
> > answer from a table that contains the values: Yes, No, NA.

>
> > Is it possible to have the Project\TaxDeptNotified field default to a
> > certain value (NA)based on the value in the Client\TaxForm field? (If the
> > Client Form is NOT a 990, the Answer s/b NA.)

>
> > TIA! - Hide quoted text -

>
> - Show quoted text -


Let's assume that the Clients and Projects tables have a master/detail
relationship. The frmClients is the main form and the frmProjectsSub
is a subform. These forms are linked based on ClientID.

Navigation to a new Clients row causes a new set of Projects rows to
appear. This has triggered the "on current" event in the
frmProjectsSub.

In the frmProjectsSub's "Form_Current" event handler, try

Private Sub Form_Current()
if Parent.ClientID.value = "999" then
Me.TaxDeptNotified.defaultvalue = NULL
else
Me.TaxDeptNotified.defaultvalue = "NA"
end if
end sub


 
Reply With Quote
 
=?Utf-8?B?S2FyaW4=?=
Guest
Posts: n/a
 
      16th Jul 2007
This does not work except for the first "N/A" record it comes to. I'm going
to add more detail to my original message.

"(E-Mail Removed)" wrote:

> On Jul 16, 7:08 am, Karin <Ka...@discussions.microsoft.com> wrote:
> > Additionally - I could use a form to accomplish the request below. I have a
> > main form from Table Client and a Subform from Table Projects, both of which
> > include the fields I talk about below.
> >
> >
> >
> > "Karin" wrote:
> > > Hi, I have two tables "Client" and "Projects" that are related by ID number.
> > > In the Client table there is a field named "TaxForm".

> >
> > > In the Projects table, I have a field named "TaxDeptNotified", which is a
> > > text field. Normally I would create a combo box on a form to select the
> > > answer from a table that contains the values: Yes, No, NA.

> >
> > > Is it possible to have the Project\TaxDeptNotified field default to a
> > > certain value (NA)based on the value in the Client\TaxForm field? (If the
> > > Client Form is NOT a 990, the Answer s/b NA.)

> >
> > > TIA! - Hide quoted text -

> >
> > - Show quoted text -

>
> Let's assume that the Clients and Projects tables have a master/detail
> relationship. The frmClients is the main form and the frmProjectsSub
> is a subform. These forms are linked based on ClientID.
>
> Navigation to a new Clients row causes a new set of Projects rows to
> appear. This has triggered the "on current" event in the
> frmProjectsSub.
>
> In the frmProjectsSub's "Form_Current" event handler, try
>
> Private Sub Form_Current()
> if Parent.ClientID.value = "999" then
> Me.TaxDeptNotified.defaultvalue = NULL
> else
> Me.TaxDeptNotified.defaultvalue = "NA"
> end if
> end sub
>
>
>

 
Reply With Quote
 
=?Utf-8?B?S2FyaW4=?=
Guest
Posts: n/a
 
      16th Jul 2007
Yet more detail...

I only want to update the Projects.TaxDeptNotified field if the
Client.TaxForm field is not (<>) 990. I will be manually updating the field
otherwise. (I suppose I could periodically run an update query to handle
this.)

Updating through the Main/Sub Form may not be the most appropriate place for
this update, as I do store the results in the Project Table.

"Karin" wrote:

> Additionally - I could use a form to accomplish the request below. I have a
> main form from Table Client and a Subform from Table Projects, both of which
> include the fields I talk about below.
>
> "Karin" wrote:
>
> > Hi, I have two tables "Client" and "Projects" that are related by ID number.
> > In the Client table there is a field named "TaxForm".
> >
> > In the Projects table, I have a field named "TaxDeptNotified", which is a
> > text field. Normally I would create a combo box on a form to select the
> > answer from a table that contains the values: Yes, No, NA.
> >
> > Is it possible to have the Project\TaxDeptNotified field default to a
> > certain value (NA)based on the value in the Client\TaxForm field? (If the
> > Client Form is NOT a 990, the Answer s/b NA.)
> >
> > TIA!

 
Reply With Quote
 
=?Utf-8?B?S2FyaW4=?=
Guest
Posts: n/a
 
      16th Jul 2007
Sorry that it's taking a bijillion messages to get my question/needs across.
Per my last I said I could run an update query, which would update the table,
but it doesn't update the combo boxes on the form, so that answer doesn't
really work.

"Karin" wrote:

> Yet more detail...
>
> I only want to update the Projects.TaxDeptNotified field if the
> Client.TaxForm field is not (<>) 990. I will be manually updating the field
> otherwise. (I suppose I could periodically run an update query to handle
> this.)
>
> Updating through the Main/Sub Form may not be the most appropriate place for
> this update, as I do store the results in the Project Table.
>
> "Karin" wrote:
>
> > Additionally - I could use a form to accomplish the request below. I have a
> > main form from Table Client and a Subform from Table Projects, both of which
> > include the fields I talk about below.
> >
> > "Karin" wrote:
> >
> > > Hi, I have two tables "Client" and "Projects" that are related by ID number.
> > > In the Client table there is a field named "TaxForm".
> > >
> > > In the Projects table, I have a field named "TaxDeptNotified", which is a
> > > text field. Normally I would create a combo box on a form to select the
> > > answer from a table that contains the values: Yes, No, NA.
> > >
> > > Is it possible to have the Project\TaxDeptNotified field default to a
> > > certain value (NA)based on the value in the Client\TaxForm field? (If the
> > > Client Form is NOT a 990, the Answer s/b NA.)
> > >
> > > TIA!

 
Reply With Quote
 
Jason Lopez
Guest
Posts: n/a
 
      16th Jul 2007
In the field properties is the Default Value selection under the Data tab.
Set that to what you are looking for initially and then all your records
will be marked "N/A" unless you change the value.

Jason Lopez

"Karin" <(E-Mail Removed)> wrote in message
news:5B301112-EE6B-498D-B288-(E-Mail Removed)...
> Sorry that it's taking a bijillion messages to get my question/needs
> across.
> Per my last I said I could run an update query, which would update the
> table,
> but it doesn't update the combo boxes on the form, so that answer doesn't
> really work.
>
> "Karin" wrote:
>
>> Yet more detail...
>>
>> I only want to update the Projects.TaxDeptNotified field if the
>> Client.TaxForm field is not (<>) 990. I will be manually updating the
>> field
>> otherwise. (I suppose I could periodically run an update query to handle
>> this.)
>>
>> Updating through the Main/Sub Form may not be the most appropriate place
>> for
>> this update, as I do store the results in the Project Table.
>>
>> "Karin" wrote:
>>
>> > Additionally - I could use a form to accomplish the request below. I
>> > have a
>> > main form from Table Client and a Subform from Table Projects, both of
>> > which
>> > include the fields I talk about below.
>> >
>> > "Karin" wrote:
>> >
>> > > Hi, I have two tables "Client" and "Projects" that are related by ID
>> > > number.
>> > > In the Client table there is a field named "TaxForm".
>> > >
>> > > In the Projects table, I have a field named "TaxDeptNotified", which
>> > > is a
>> > > text field. Normally I would create a combo box on a form to
>> > > select the
>> > > answer from a table that contains the values: Yes, No, NA.
>> > >
>> > > Is it possible to have the Project\TaxDeptNotified field default to a
>> > > certain value (NA)based on the value in the Client\TaxForm field?
>> > > (If the
>> > > Client Form is NOT a 990, the Answer s/b NA.)
>> > >
>> > > TIA!



 
Reply With Quote
 
Jason Lopez
Guest
Posts: n/a
 
      16th Jul 2007
For something similar that I am working on, how would I write the code to go
reverse? IOW, I have a parent field that needs to put a value in the
control on a subform. I can see the "Parent" and "Me" marks on this set of
code. But would I identify the subform in the code as
Forms.Subform1.Field.defaultvalue = "NA?"

Jason Lopez
"Karin" <(E-Mail Removed)> wrote in message
news:A237BD41-0D79-4665-9AE1-(E-Mail Removed)...
> This does not work except for the first "N/A" record it comes to. I'm
> going
> to add more detail to my original message.
>
> "(E-Mail Removed)" wrote:
>
>> On Jul 16, 7:08 am, Karin <Ka...@discussions.microsoft.com> wrote:
>> > Additionally - I could use a form to accomplish the request below. I
>> > have a
>> > main form from Table Client and a Subform from Table Projects, both of
>> > which
>> > include the fields I talk about below.
>> >
>> >
>> >
>> > "Karin" wrote:
>> > > Hi, I have two tables "Client" and "Projects" that are related by ID
>> > > number.
>> > > In the Client table there is a field named "TaxForm".
>> >
>> > > In the Projects table, I have a field named "TaxDeptNotified", which
>> > > is a
>> > > text field. Normally I would create a combo box on a form to
>> > > select the
>> > > answer from a table that contains the values: Yes, No, NA.
>> >
>> > > Is it possible to have the Project\TaxDeptNotified field default to a
>> > > certain value (NA)based on the value in the Client\TaxForm field?
>> > > (If the
>> > > Client Form is NOT a 990, the Answer s/b NA.)
>> >
>> > > TIA! - Hide quoted text -
>> >
>> > - Show quoted text -

>>
>> Let's assume that the Clients and Projects tables have a master/detail
>> relationship. The frmClients is the main form and the frmProjectsSub
>> is a subform. These forms are linked based on ClientID.
>>
>> Navigation to a new Clients row causes a new set of Projects rows to
>> appear. This has triggered the "on current" event in the
>> frmProjectsSub.
>>
>> In the frmProjectsSub's "Form_Current" event handler, try
>>
>> Private Sub Form_Current()
>> if Parent.ClientID.value = "999" then
>> Me.TaxDeptNotified.defaultvalue = NULL
>> else
>> Me.TaxDeptNotified.defaultvalue = "NA"
>> end if
>> end sub
>>
>>
>>



 
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
Default value equals same value in another field in the same table Akilah Microsoft Access 1 17th Jan 2008 05:05 PM
using a function w/table field to enter default in another field =?Utf-8?B?dHJleA==?= Microsoft Access VBA Modules 1 12th Sep 2007 01:54 PM
Default Value for Field in either Form or Table =?Utf-8?B?Q2Fkc3RpbGxv?= Microsoft Access Forms 3 21st Jun 2006 11:21 PM
Enter a Default Value in a Field in a Table =?Utf-8?B?YWNjZXNzIHVzZXI=?= Microsoft Access 5 10th May 2006 09:35 AM
Can a field in a table be the default value of another field? Dave Microsoft Access Database Table Design 1 1st Sep 2004 04:05 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:46 AM.