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 » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Calculated Field Problem: Picking a date based on value in another field



 
 
Thread Tools Display Modes
  #1  
Old June 22nd, 2004, 09:49 PM
Dkline
external usenet poster
 
Posts: n/a
Default Calculated Field Problem: Picking a date based on value in another field

Please forgive me for asking about a calculated field in a table. I know it
shouldn't be done but I'm getting leaned on to figure out how to do this.

The controlling field can have a number of values. If the value is one of
three items "A", "B", or "C", they want another field in the same record to
be set to the date in the "BillThruDate" field. Else they want the date in
that calculated field to be set to the "TransactionDate".

Can this be done?


  #2  
Old June 22nd, 2004, 09:53 PM
Lynn Trapp
external usenet poster
 
Posts: n/a
Default Calculated Field Problem: Picking a date based on value in another field

You can't do it directly in the table, but in your data entry form you can
use the AfterUpdate event of your form to update the value of the record as
you need it.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


"Dkline" wrote in message
...
Please forgive me for asking about a calculated field in a table. I know

it
shouldn't be done but I'm getting leaned on to figure out how to do this.

The controlling field can have a number of values. If the value is one of
three items "A", "B", or "C", they want another field in the same record

to
be set to the date in the "BillThruDate" field. Else they want the date in
that calculated field to be set to the "TransactionDate".

Can this be done?




  #3  
Old June 23rd, 2004, 01:02 PM
Dkline
external usenet poster
 
Posts: n/a
Default Calculated Field Problem: Picking a date based on value in another field

Thank you for the solution. I ended up with:

Private Sub Form_AfterUpdate()
Dim strTransactionType As String
strTransactionType = Me!TransactionType

Select Case strTransactionType
Case "COI Charge", "M&E Fee", "Loan Charge"
Me![Bill Date] = Me![BillThruDate]
Case Else
Me![Bill Date] = Me![TransactionDate]
End Select
End Sub

Works like a champ. Thanks again!

"Lynn Trapp" wrote in message
...
You can't do it directly in the table, but in your data entry form you can
use the AfterUpdate event of your form to update the value of the record

as
you need it.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


"Dkline" wrote in message
...
Please forgive me for asking about a calculated field in a table. I know

it
shouldn't be done but I'm getting leaned on to figure out how to do

this.

The controlling field can have a number of values. If the value is one

of
three items "A", "B", or "C", they want another field in the same record

to
be set to the date in the "BillThruDate" field. Else they want the date

in
that calculated field to be set to the "TransactionDate".

Can this be done?






  #4  
Old June 23rd, 2004, 04:05 PM
Lynn Trapp
external usenet poster
 
Posts: n/a
Default Calculated Field Problem: Picking a date based on value in another field

Excellent!

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


"Dkline" wrote in message
...
Thank you for the solution. I ended up with:

Private Sub Form_AfterUpdate()
Dim strTransactionType As String
strTransactionType = Me!TransactionType

Select Case strTransactionType
Case "COI Charge", "M&E Fee", "Loan Charge"
Me![Bill Date] = Me![BillThruDate]
Case Else
Me![Bill Date] = Me![TransactionDate]
End Select
End Sub

Works like a champ. Thanks again!

"Lynn Trapp" wrote in message
...
You can't do it directly in the table, but in your data entry form you

can
use the AfterUpdate event of your form to update the value of the record

as
you need it.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


"Dkline" wrote in message
...
Please forgive me for asking about a calculated field in a table. I

know
it
shouldn't be done but I'm getting leaned on to figure out how to do

this.

The controlling field can have a number of values. If the value is one

of
three items "A", "B", or "C", they want another field in the same

record
to
be set to the date in the "BillThruDate" field. Else they want the

date
in
that calculated field to be set to the "TransactionDate".

Can this be done?








 




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 09:14 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.