Birthday and Image

  • Thread starter alpapak via AccessMonster.com
  • Start date
A

alpapak via AccessMonster.com

Birthday and Image
------------------------------------------------------------------------------
--

hi
i have a form with the field [Birthday] = Short day
and an image BirthDay_Eikona.

I want the image to be visible 10 days after [birthday] and 30 days before
[birthday]

i test the code :

If Me.[birthday] + ((Int((Now() - [birthday]) / 365.25) + 1) * 365.25) > Now()
- 10 Or Me.[birthday] + ((Int((Now() - [birthday]) / 365.25) + 1) * 365.25) <
Now() + 30 Then
Me.BirthDay_eikona.Visible = True
Else
Me.BirthDay_eikona.Visible = False
End If

But it doesn't work.
i manage to make it work when i change

If Me.[birthday] + ((Int((Now() - [birthday]) / 365.25) + 1) * 365.25) > Now()
And Me.[birthday] + ((Int((Now() - [birthday]) / 365.25) + 1) * 365.25) < Now
() + 30 Then

but i get [Birthday] from Now() and Now()+30

I want Now()-10 and Now()+30???
 
G

Graham R Seach

If (Date => dteBirthday - 30) And (Date <= dteBirthday + 10) Then
Me.BirthDay_eikona.Visible = True
Else
Me.BirthDay_eikona.Visible = False
End If

Regards,
Graham R Seach
Microsoft Access MVP
Canberra, Australia
 
A

alpapak via AccessMonster.com

thxs for the reply
i test it but it doesn't work
i change dtebirthday with birthday which is my field and test it with a field
(format dd/mm/yyyy) 27/3/2006 and date 28/3/2006. No image was visible


If (Date => Birthday - 30) And (Date <= Birthday + 10) Then
Me.BirthDay_eikona.Visible = True
Else
Me.BirthDay_eikona.Visible = False
End If
 
G

Graham R Seach

Then there's something else wrong. Here is the test code I used after your
last post:
Public Function CheckDate(myDate As Date)
Dim dteBirthday As Date

dteBirthday = Date

If (myDate >= dteBirthday - 30) And (myDate <= dteBirthday + 10)
Then
CheckDate = "Visible"
Else
CheckDate = "NOT Visible"
End If
End Function

....and here is the Immediate Window output:
?CheckDate(date)
Visible
?CheckDate(date-30)
Visible
?CheckDate(date-31)
NOT Visible
?CheckDate(date+10)
Visible
?CheckDate(date+11)
NOT Visible

I'd suggest that maybe you also have a variable called Birthday. You should
disambiguate things by specifying you want to use the textbox:
If (Date => Me!Birthday - 30) And (Date <= Me!Birthday + 10) Then
Me!BirthDay_eikona.Visible = True
Else
Me!BirthDay_eikona.Visible = False
End If

Regards,
Graham R Seach
Microsoft Access MVP
Canberra, Australia
 

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