dbTalk Databases Forums  

Working with dates in A2010

comp.databases.ms-access comp.databases.ms-access


Discuss Working with dates in A2010 in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Salad
 
Posts: n/a

Default Working with dates in A2010 - 03-09-2010 , 06:45 PM






I can take any date and do something like
? Year(datVar)
and it will return the year.

The macros in a form don't have many date() functions. There was one
called FormatDateTime() but that doesn't extract the sections or a date
or time.

Ayy idea how to extract portions of a date in A2010 using a Macro?

Reply With Quote
  #2  
Old   
Albert D. Kallal
 
Posts: n/a

Default Re: Working with dates in A2010 - 03-09-2010 , 11:51 PM






However, we can get a wonderful response of windows like
experience if we make every single thing we do run server side. So not only
are the Access forms running Java, it's a asynchronous so they are actually
AJAX forms.


should read

However, we can NOT get a wonderful response of windows like
experience if we make every single thing we do run server side. So not only
are the Access forms running Java, it's a asynchronous so they are actually
AJAX forms.

Reply With Quote
  #3  
Old   
Albert D. Kallal
 
Posts: n/a

Default Re: Working with dates in A2010 - 03-10-2010 , 01:29 AM



"Salad" <salad (AT) oilandvinegar (DOT) com> wrote


Quote:
Curious. Are SQL statements query only or can one run on the fly a
strSQL = "Select * From Customers"
run the statement somehow? IOW, should most/all queries already be built
beforehand?

No sql on the fly. This feature is missed in web development (likely the
hardest feature we give up). So, you have to use set filter.
There also the ability to pass/feed queries with a new parameter
option we have.

Quote:
I read someplace you can have a maximum of 255 tempvars. Do you find that
a sufficient amount? Or do you usually clean up/close your tempvars when
a form closes since tempvars are global in scope?
It seems to be more then enough. Remember, you also have local
vars in those forms. And, data macros are also local vars. And, for
many tempvars, you can often re-cycle and re-use them. So, for
example, I often use lngID for the current form, and it quite rare
that I have many forms open in at the same time in web based systems
that would trip this code issue up.

At the end of the day, web applications are by nature going to be a
good deal simpler then rich desktop applications.

Quote:
I think I get your point. One could do a SetTempVar on a date and in the
query extract the parts; day, month, year, hour, minutes, seconds.
Forget the code, use a query. Is that the gist?

Well, it not that you would set a temp var and then "in the query" extract
the parts. I not calling some query. The simple issue is that if your form
has column like invoiceDate, then you just add a few extra columns to the
query called iYear, iMonth in the query builder. We then base the form on
that query.

So, we don't set any temp vars or anything, we just added those columns to
the query. So, those extra columns in the query builder would look like:

iYear: Year([InvoiceDate]) iMonth: ([InvoiceDate])

So, if our form is based on this query, then in macro code I can go:

MessageBox

=("The current invoice month is " & [iMonth])

So, I am not even calling the query. It just that the form now has 2 extra
columns with the year and month that we need. You could even drop those
columns on the form if you wanted the form to display the month, or year of
the invoice. So I am just basing the form on this query. I can thus use
those columns anywhere in the forms macro code and I have the month and year
value at my fingertips. Queries have a great function set, so you can use
that rich query function set to get those expressions back into forms and
also for use in your macro code.

As mentioned, it really depends if you talking about a bound column (that is
my above assumption here). I think in most cases, you using a where clause
(which thus has the date functions you need), or you passing to a data macro
(which again has the functions you need).

However, as the above shows, if you needed a message box to give you some
message with the current month value, then the above query trick is a simple
easy solution here.

Here is a screen shot of a web query, and again you can see the expressions
I building:
http://cid-b18a57cb5f6af0fa.skydrive...king/webqu.png

(note if you click a 2nd time on those pictures...they do zoom in).

And here is one that is using the hour function:
http://cid-b18a57cb5f6af0fa.skydrive...ng/webqury.png
(note above, I have the expression builder up, and you can see the function
set is very rich).

The function set in forms is very limited, but as the above shows, you can
well work around this issue..

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal (AT) msn (DOT) com

Reply With Quote
  #4  
Old   
David W. Fenton
 
Posts: n/a

Default Re: Working with dates in A2010 - 03-10-2010 , 01:42 PM



"Albert D. Kallal" <PleaseNOOOsPAMmkallal (AT) msn (DOT) com> wrote in
news:aoGln.9196$NH1.429 (AT) newsfe14 (DOT) iad:

Quote:
I should point out that that macro code you write in a form, will
actually be converted into Java. That code runs client side. I am
repeat this!! That form code (or what we call a UI macro) runs as
Java script inside of your browser
Java and JavaScript are two completely different languages with
almost nothing in common. Please don't confuse the issue by
erroneously mentioning Java in this context.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/

Reply With Quote
  #5  
Old   
David W. Fenton
 
Posts: n/a

Default Re: Working with dates in A2010 - 03-10-2010 , 01:44 PM



"Albert D. Kallal" <PleaseNOOOsPAMmkallal (AT) msn (DOT) com> wrote in
news:ysGln.9197$NH1.1256 (AT) newsfe14 (DOT) iad:

Quote:
So not only
are the Access forms running Java, it's a asynchronous so they are
actually AJAX forms.
NO NO NO NO NO.

They are not running Java.

They are running *JavaScript* which has almost nothing at all in
common with Java. NOTHING.

Please be more precise, Albert.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/

Reply With Quote
  #6  
Old   
Salad
 
Posts: n/a

Default Re: Working with dates in A2010 - 03-11-2010 , 10:54 AM



Albert D. Kallal wrote:

Quote:
"Salad" <salad (AT) oilandvinegar (DOT) com> wrote in message
news8udnX86_YdUpgrWnZ2dnUVZ_tGdnZ2d (AT) earthlink (DOT) com...


Curious. Are SQL statements query only or can one run on the fly a
strSQL = "Select * From Customers"
run the statement somehow? IOW, should most/all queries already be built
beforehand?


No sql on the fly. This feature is missed in web development (likely the
hardest feature we give up). So, you have to use set filter.
There also the ability to pass/feed queries with a new parameter
option we have.

I read someplace you can have a maximum of 255 tempvars. Do you find
that
a sufficient amount? Or do you usually clean up/close your tempvars when
a form closes since tempvars are global in scope?


It seems to be more then enough. Remember, you also have local
vars in those forms. And, data macros are also local vars. And, for
many tempvars, you can often re-cycle and re-use them. So, for
example, I often use lngID for the current form, and it quite rare
that I have many forms open in at the same time in web based systems
that would trip this code issue up.

At the end of the day, web applications are by nature going to be a
good deal simpler then rich desktop applications.

I think I get your point. One could do a SetTempVar on a date and in the
query extract the parts; day, month, year, hour, minutes, seconds.
Forget the code, use a query. Is that the gist?


Well, it not that you would set a temp var and then "in the query" extract
the parts. I not calling some query. The simple issue is that if your form
has column like invoiceDate, then you just add a few extra columns to the
query called iYear, iMonth in the query builder. We then base the form on
that query.

So, we don't set any temp vars or anything, we just added those columns to
the query. So, those extra columns in the query builder would look like:

iYear: Year([InvoiceDate]) iMonth: ([InvoiceDate])

So, if our form is based on this query, then in macro code I can go:

MessageBox

=("The current invoice month is " & [iMonth])

So, I am not even calling the query. It just that the form now has 2 extra
columns with the year and month that we need. You could even drop those
columns on the form if you wanted the form to display the month, or year of
the invoice. So I am just basing the form on this query. I can thus use
those columns anywhere in the forms macro code and I have the month and
year
value at my fingertips. Queries have a great function set, so you can use
that rich query function set to get those expressions back into forms and
also for use in your macro code.

As mentioned, it really depends if you talking about a bound column
(that is
my above assumption here). I think in most cases, you using a where clause
(which thus has the date functions you need), or you passing to a data
macro
(which again has the functions you need).

However, as the above shows, if you needed a message box to give you some
message with the current month value, then the above query trick is a
simple
easy solution here.

Here is a screen shot of a web query, and again you can see the expressions
I building:
http://cid-b18a57cb5f6af0fa.skydrive...king/webqu.png


(note if you click a 2nd time on those pictures...they do zoom in).

And here is one that is using the hour function:
http://cid-b18a57cb5f6af0fa.skydrive...ng/webqury.png

(note above, I have the expression builder up, and you can see the function
set is very rich).

The function set in forms is very limited, but as the above shows, you can
well work around this issue..

Thank you. Gotta wrap my brain around this.

Reply With Quote
  #7  
Old   
Albert D. Kallal
 
Posts: n/a

Default Re: Working with dates in A2010 - 03-12-2010 , 12:30 AM



"David W. Fenton" <XXXusenet (AT) dfenton (DOT) com.invalid> wrote

Quote:
"Albert D. Kallal" <PleaseNOOOsPAMmkallal (AT) msn (DOT) com> wrote in
news:ysGln.9197$NH1.1256 (AT) newsfe14 (DOT) iad:

So not only
are the Access forms running Java, it's a asynchronous so they are
actually AJAX forms.

NO NO NO NO NO.

They are not running Java.

They are running *JavaScript* which has almost nothing at all in
common with Java. NOTHING.

Please be more precise, Albert.

Agreed.

However, I well just assumed mentioning AJAX implied this means java script.
However, you are correct. JavaScript is included with the browser and is
lightweight and requires no additional loading of software.

The java runtime implies a much heaver footprint and an very different
software experience and has a separate software installing requirement.



--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal (AT) msn (DOT) com

Reply With Quote
  #8  
Old   
David W. Fenton
 
Posts: n/a

Default Re: Working with dates in A2010 - 03-12-2010 , 11:06 AM



"Albert D. Kallal" <PleaseNOOOsPAMmkallal (AT) msn (DOT) com> wrote in
news:3clmn.18015$ND2.16637 (AT) newsfe05 (DOT) iad:

Quote:
"David W. Fenton" <XXXusenet (AT) dfenton (DOT) com.invalid> wrote in message
news:Xns9D3795FCE50E9f99a49ed1d0c49c5bbb2 (AT) 74 (DOT) 209.136.94...
"Albert D. Kallal" <PleaseNOOOsPAMmkallal (AT) msn (DOT) com> wrote in
news:ysGln.9197$NH1.1256 (AT) newsfe14 (DOT) iad:

So not only
are the Access forms running Java, it's a asynchronous so they
are actually AJAX forms.

NO NO NO NO NO.

They are not running Java.

They are running *JavaScript* which has almost nothing at all in
common with Java. NOTHING.

Please be more precise, Albert.

Agreed.

However, I well just assumed mentioning AJAX implied this means
java script.
AJAX doesn't *assume* JavaScript, it *IS* JavaScript.

Quote:
However, you are correct. JavaScript is included with the browser
and is lightweight and requires no additional loading of software.
And the language has virtually nothing in common with Java except
the fact that both are modelled on C-like conventions. When Netscape
created JavaScript, Sun's Java was really hot, and a threat to
Netscape's play for domination of the web, so Netscape licensed the
name and used it for their browser-embedded client-side scripting
language.

See http://en.wikipedia.org/wiki/JavaScript for the early history.
Until reading that, I didn't realize the name had been licensed and
that Sun still owned the name JavaScript.

Quote:
The java runtime implies a much heaver footprint and an very
different software experience and has a separate software
installing requirement.
There is simply no reason to confuse the two except if you don't
understand what they are. That's why it's so surprising that you
would repeatedly erroneously refer to JavaScript as Java, since I
know perfectly well you don't think you're writing Java when you're
using JavaScript.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.