Date add Criteria on Continuous Form

T

tighe

All,
thank you for all the previouis help.

currently i have a form has three fileds to tracks letter "Recieve",
"ResponseDue", and "Respond."
on the recieve text box's afterupdate event i have:Me.ResponseDue =
DateAdd("d", 30, Me.Recieve).

what i need is that on the first letter, the minimum date, if an the main
form the criteria is "NMA" that the date add be 60.

thank you for the help in advance. AC2007/XP.
 
D

Daryl S

Tighe -

The easiest way is to Dim an integer variable and use that. Try this:

Dim AddDays as Integer
If Parent.txtCriteria = "NMA" Then
AddDays = 60
Else
AddDays = 30
End If

DateAdd("d", AddDays, Me.Recieve)

You will need to use the proper control on your parent form where the "NMA"
is - I just made up txtCriteria.
 
T

tighe

thanks daryl.

do you know how i would only add 60 for the first NMA letter [Recieve]
date/value?
 
D

Daryl S

Tighe -

How do you know if the record is the 'first' NMA record? If you can tell,
then you can use that criteria in the same way.

--
Daryl S


tighe said:
thanks daryl.

do you know how i would only add 60 for the first NMA letter [Recieve]
date/value?

Daryl S said:
Tighe -

The easiest way is to Dim an integer variable and use that. Try this:

Dim AddDays as Integer
If Parent.txtCriteria = "NMA" Then
AddDays = 60
Else
AddDays = 30
End If

DateAdd("d", AddDays, Me.Recieve)

You will need to use the proper control on your parent form where the "NMA"
is - I just made up txtCriteria.
 
T

tighe

Daryl,

i do have an autonumber[DateNum] and Client_ID in the table, so i should be
able to look for the minimum of that and type="NMA". i wasnt sure how to
reference that on the form, i guess i need to refrence the table since the
form is continuous?

thanks for sticking with my request.

Daryl S said:
Tighe -

How do you know if the record is the 'first' NMA record? If you can tell,
then you can use that criteria in the same way.

--
Daryl S


tighe said:
thanks daryl.

do you know how i would only add 60 for the first NMA letter [Recieve]
date/value?

Daryl S said:
Tighe -

The easiest way is to Dim an integer variable and use that. Try this:

Dim AddDays as Integer
If Parent.txtCriteria = "NMA" Then
AddDays = 60
Else
AddDays = 30
End If

DateAdd("d", AddDays, Me.Recieve)

You will need to use the proper control on your parent form where the "NMA"
is - I just made up txtCriteria.

--
Daryl S


:

All,
thank you for all the previouis help.

currently i have a form has three fileds to tracks letter "Recieve",
"ResponseDue", and "Respond."
on the recieve text box's afterupdate event i have:Me.ResponseDue =
DateAdd("d", 30, Me.Recieve).

what i need is that on the first letter, the minimum date, if an the main
form the criteria is "NMA" that the date add be 60.

thank you for the help in advance. AC2007/XP.
 
D

Daryl S

Tighe -

You can get the minimum [Receive] for a client_ID "NMA" with the following:

Dim minReceive As Date

minReceive = DMin("[Receive]","[TableName]","[Type] = 'NMA' AND [Client_ID]
= " & Me.Client_ID & "'")

You will need to put your source table name in for TableName, and the
correct fieldnames for Receive, Type, and Client_ID if they are different.

Then you would add the days to minReceive instead of Me.Receive.

--
Daryl S


tighe said:
Daryl,

i do have an autonumber[DateNum] and Client_ID in the table, so i should be
able to look for the minimum of that and type="NMA". i wasnt sure how to
reference that on the form, i guess i need to refrence the table since the
form is continuous?

thanks for sticking with my request.

Daryl S said:
Tighe -

How do you know if the record is the 'first' NMA record? If you can tell,
then you can use that criteria in the same way.

--
Daryl S


tighe said:
thanks daryl.

do you know how i would only add 60 for the first NMA letter [Recieve]
date/value?

:

Tighe -

The easiest way is to Dim an integer variable and use that. Try this:

Dim AddDays as Integer
If Parent.txtCriteria = "NMA" Then
AddDays = 60
Else
AddDays = 30
End If

DateAdd("d", AddDays, Me.Recieve)

You will need to use the proper control on your parent form where the "NMA"
is - I just made up txtCriteria.

--
Daryl S


:

All,
thank you for all the previouis help.

currently i have a form has three fileds to tracks letter "Recieve",
"ResponseDue", and "Respond."
on the recieve text box's afterupdate event i have:Me.ResponseDue =
DateAdd("d", 30, Me.Recieve).

what i need is that on the first letter, the minimum date, if an the main
form the criteria is "NMA" that the date add be 60.

thank you for the help in advance. AC2007/XP.
 
T

tighe

ok i got that "working."

i have this running on event "after update" but the minReceive is not
evaluated soon enough. so iended up using the NZ function with using Date(),
which works in this scenario.

Private Sub Recieve_AfterUpdate()
minReceive = Nz(DMin("Recieve", "NMA_Dates", "[Firm_ID]=
Forms![001_Start]![List9]"), Date)

If Forms![05_Firm_Status]![Combo189] = "NMA" Then

If Me.Recieve.Value = minReceive Then
Me.ResponseDue = DateAdd("d", 60, Me.Recieve)
Else: Me.ResponseDue = DateAdd("d", 30, Me.Recieve)
End If
Else: Me.ResponseDue = DateAdd("d", 30, Me.Recieve)
End If
End Sub
Daryl S said:
Tighe -

You can get the minimum [Receive] for a client_ID "NMA" with the following:

Dim minReceive As Date

minReceive = DMin("[Receive]","[TableName]","[Type] = 'NMA' AND [Client_ID]
= " & Me.Client_ID & "'")

You will need to put your source table name in for TableName, and the
correct fieldnames for Receive, Type, and Client_ID if they are different.

Then you would add the days to minReceive instead of Me.Receive.

--
Daryl S


tighe said:
Daryl,

i do have an autonumber[DateNum] and Client_ID in the table, so i should be
able to look for the minimum of that and type="NMA". i wasnt sure how to
reference that on the form, i guess i need to refrence the table since the
form is continuous?

thanks for sticking with my request.

Daryl S said:
Tighe -

How do you know if the record is the 'first' NMA record? If you can tell,
then you can use that criteria in the same way.

--
Daryl S


:

thanks daryl.

do you know how i would only add 60 for the first NMA letter [Recieve]
date/value?

:

Tighe -

The easiest way is to Dim an integer variable and use that. Try this:

Dim AddDays as Integer
If Parent.txtCriteria = "NMA" Then
AddDays = 60
Else
AddDays = 30
End If

DateAdd("d", AddDays, Me.Recieve)

You will need to use the proper control on your parent form where the "NMA"
is - I just made up txtCriteria.

--
Daryl S


:

All,
thank you for all the previouis help.

currently i have a form has three fileds to tracks letter "Recieve",
"ResponseDue", and "Respond."
on the recieve text box's afterupdate event i have:Me.ResponseDue =
DateAdd("d", 30, Me.Recieve).

what i need is that on the first letter, the minimum date, if an the main
form the criteria is "NMA" that the date add be 60.

thank you for the help in advance. AC2007/XP.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top