Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP6 Datetime() and timer control
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
VFP6 Datetime() and timer control
Divers
Thread ID:
00628798
Message ID:
00628798
Vues:
71
Hello All,

I'd like to create a automated email but am having problems with setting up the process so it runs at a later designated date and time.

I seem to be complicating this but can't seem to get a reasonable solution.

The first method takes info from several controls on a form and is suppose to build a datetime() value as in datetime(2002,3,6,17,30,30) && 3/5/2002 9:30:30

The second method is in a timer control which is enabled by the user and then runs the code when the time is met.

I can make it work by hard coding the starting datetime value but need help converting the string to the datetime() value.

TIA

Jim Harvey


Method.m_timer()
***begin
with thisform.Hscntemail
lc_date = .hstxtdate.value
ln_year = year(lc_date)
ln_month = month(lc_date)
ln_day = day(lc_date)
ln_hours = .hspnhours.value
ln_minutes = .hspnminutes.value
ln_seconds = .hspnseconds.value
.Hstxtstarttime.value = ltrim(str(ln_year)) + ", " + ltrim(str(ln_month)) + ", " + ltrim(str(ln_day)) ;
+ ", " + ltrim(str(ln_hours)) + ", " + ltrim(str(ln_minutes)) + ", " + ltrim(str(ln_seconds))
thisform.r_cstarttime = "datetime(" + ltrim(str(ln_year)) + ", " + ltrim(str(ln_month)) + ", " + ltrim(str(ln_day)) ;
+ ", " + ltrim(str(ln_hours)) + ", " + ltrim(str(ln_minutes)) + ", " + ltrim(str(ln_seconds)) + ")"
endwith

****end


This method wants to make the time fire the m_email() method which creates and send the email through automation.

I can't seem to get the syntax right, data mismatch error message.


method.m_starttime()
***method located in timer event of timer control
***begin
ldt_starttime = thisform.r_cstarttime && r_cstarttime comes from m_timer method
ldt_stoptime = ldt_starttime + 2 && wants to add 2 secconds to datetime() start
if datetime() > ldt_starttime and datetime() < ldt_stoptime && runs m_email()
thisform.m_email()
This.enabled = .f.
Endif
***end
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform