VBA/ VB6 Help - For use in Access

indyjones

OSNN.net Adventurer
Joined
5 Nov 2002
Messages
1,567
Hi All

I was hoping somebody could help me.
I need some VB code to trigger an event such as a text box on Monday each week. It's for a database I am writing at work and I need it to i display a text box stating that calibration is due on Monday every week

Any help will be greatly appreciated

Cheers
 

indyjones

OSNN.net Adventurer
Joined
5 Nov 2002
Messages
1,567
Come on surely somebody must know or is VB just that prehistoric now?
 

diakin

OSNN Newbie
Joined
11 Feb 2007
Messages
4
Hi All
I was hoping somebody could help me.
I need some VB code to trigger an event such as a text box on Monday each week. It's for a database I am writing at work and I need it to i display a text box stating that calibration is due on Monday every week
Any help will be greatly appreciated
Cheers

Hi!

I use Rapid-Q basic, but in VB it's similar imho/
You can use DATE$ function
A function that returns a string containing the current date formatted as MM-DD-YYYY. Where MM = month (1-12), DD = day (1-31) and YY = year (1980-2099)

To get Weekday you can use this function
Weekday(Date[, FirstDayOfWeek])

heh.. you also can use this Win Api funtion from VB.

'-----------------
Private Declare Sub GetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)
Private Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
Private Sub Form_Load()
'KPD-Team 1998
'URL: http://www.allapi.net/
'KPDTeam@Allapi.net
Dim SysTime As SYSTEMTIME
'Set the graphical mode to persistent
Me.AutoRedraw = True
'Get the system time
GetSystemTime SysTime
'Print it to the form
Me.Print "The System Date is:" & SysTime.wMonth & "-" & SysTime.wDay & "-" & SysTime.wYear
Me.Print "The System Time is:" & SysTime.wHour & ":" & SysTime.wMinute & ":" & SysTime.wSecond
End Sub


WBR, Andrew
 

indyjones

OSNN.net Adventurer
Joined
5 Nov 2002
Messages
1,567
Many thanks for that diakin, will give it a go tomorrow and see how I get on :) reps to you :)
 

indyjones

OSNN.net Adventurer
Joined
5 Nov 2002
Messages
1,567
Hmmm actually looking at the code it seem it report the current date and the current time? What I want to happen is every Monday, for there to be a message box pop up to say "calibration is due".

Cheers
 

diakin

OSNN Newbie
Joined
11 Feb 2007
Messages
4
Hmmm actually looking at the code it seem it report the current date and the current time? What I want to happen is every Monday, for there to be a message box pop up to say "calibration is due".

Cheers

This code enable to understand that "today is Monday" ;)
(see wDayOfWeek Sunday is 0, Monday is 1 and so on)


Full code is something like that:
-----------------


Private Declare Sub GetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)
Private Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type

Private Sub Form_Load()

Dim SysTime As SYSTEMTIME

'Get the system time
GetSystemTime SysTime

if SysTime.wDayOfWeek=1 then showmessage "Calibration is due"

End Sub
 

indyjones

OSNN.net Adventurer
Joined
5 Nov 2002
Messages
1,567
Perfect

Unfortunately I cannot give you more reps, but you most certainly have my thanks ! :)
 

Members online

No members online now.

Latest forum posts

Latest profile posts

hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.
Terrahertz wrote on Electronic Punk's profile.
Yo fellas!
Electronic Punk wrote on Sazar's profile.
Where are you buddy?
Perris Calderon wrote on Electronic Punk's profile.
Hey EP! All good with me, applying for Microsoft MVP right now, should have done this a while ago.

Notifications don't work, I only found your response by coming back to hunt up some threads, if you want, give me your email address so we can keep in touch easier!

Forum statistics

Threads
62,001
Messages
673,430
Members
5,595
Latest member
paulsharry23