Help!! Can Access do this?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have built a database and in the form I have a text box called Re-use
Date and I have a text box called Term Date. I need the Re-use box to let
people add a date but only when it is 1 year after the date that is entered
in the Term Date box or if empty just leave it alone. Is this possible and
if it is please be specific since Im not to good in Access. Thank you in
Advance!
Cathleen
 
Cathleen:

Yes, Access can do this.

I would look at setting the AfterUpdate event, of the Re-Use Date, to do
something like this:

IF [reusedate] < ([termdate] - 365) THEN
msgbox ("Re-Use Date must be at least 1 year beyond the Term Date.")
[reusedate] = ""
[reusedate].SetFocus
ELSE
END IF

For the "leave it alone" part, on the AfterUpdate property, for whatever
populates the Term Date, do something like this:

IF isnull([termdate]) or [termdate] = "" THEN
[reusedate].enabled = FALSE
ELSE
END IF

If the Term Date is populated when the form opens, then use the OnOpen
property of the form.

HTH

Sharkbyte
 
Thank you so much for replying... I however am having trouble. Im not sure I
did this right, since it's not working (It is still accepting any date). I
went to the form/ properties/events then clicked on the AfterUpdate box and
chose Code builder. I entered in the code you gave me and closed it out. I
then went to the OnOpen and entered the other code and closed it out. This
is what the page looks like.

Private Sub Re_Use_Date_AfterUpdate()
If [Re_Use_Date] < (Term_Date) - 365 Then
MsgBox ("Re-Use Date must be at least 1 year beyond the Term Date.")
[Re-Use Date] = ""
[Re-Use Date].SetFocus
Else
End If
End Sub
_____________________________________________________________________

Private Sub Re_Use_Date_Enter()
If IsNull([Term Date]) Or [Term Date] = "" Then
[Re-Use Date].Enabled = False
Else
End If
End Sub

Do you have any input on what it is Im doing wrong?

Thank you!
Cathleen

Sharkbyte said:
Cathleen:

Yes, Access can do this.

I would look at setting the AfterUpdate event, of the Re-Use Date, to do
something like this:

IF [reusedate] < ([termdate] - 365) THEN
msgbox ("Re-Use Date must be at least 1 year beyond the Term Date.")
[reusedate] = ""
[reusedate].SetFocus
ELSE
END IF

For the "leave it alone" part, on the AfterUpdate property, for whatever
populates the Term Date, do something like this:

IF isnull([termdate]) or [termdate] = "" THEN
[reusedate].enabled = FALSE
ELSE
END IF

If the Term Date is populated when the form opens, then use the OnOpen
property of the form.

HTH

Sharkbyte



Cathleen said:
Hi,
I have built a database and in the form I have a text box called Re-use
Date and I have a text box called Term Date. I need the Re-use box to let
people add a date but only when it is 1 year after the date that is entered
in the Term Date box or if empty just leave it alone. Is this possible and
if it is please be specific since Im not to good in Access. Thank you in
Advance!
Cathleen
 
I figured it out I needed to put in a plus sign instead of the minus. I just
want to thank you soooooo much for the code, you are a life saver! Have a
good weekend:)
Cathleen

Sharkbyte said:
Cathleen:

Yes, Access can do this.

I would look at setting the AfterUpdate event, of the Re-Use Date, to do
something like this:

IF [reusedate] < ([termdate] - 365) THEN
msgbox ("Re-Use Date must be at least 1 year beyond the Term Date.")
[reusedate] = ""
[reusedate].SetFocus
ELSE
END IF

For the "leave it alone" part, on the AfterUpdate property, for whatever
populates the Term Date, do something like this:

IF isnull([termdate]) or [termdate] = "" THEN
[reusedate].enabled = FALSE
ELSE
END IF

If the Term Date is populated when the form opens, then use the OnOpen
property of the form.

HTH

Sharkbyte



Cathleen said:
Hi,
I have built a database and in the form I have a text box called Re-use
Date and I have a text box called Term Date. I need the Re-use box to let
people add a date but only when it is 1 year after the date that is entered
in the Term Date box or if empty just leave it alone. Is this possible and
if it is please be specific since Im not to good in Access. Thank you in
Advance!
Cathleen
 
Back
Top