Re: Bizarre error involving date function

Tech-Archive recommends: Fix windows errors by optimizing your registry



Bruce, That's definitely a simplification of "an algorithm
which returns the correct # of days in a given month"
However, it would be better to set the text box's
DefaultValue property instead of the Value. This way, the
new record would not be dirtied in case the user decides not
to continue.

If Me.NewRecord Then
Me.txtMonthStart.DefaultValue = _
Format(DateSerial(Year(Date()), Month(Date()), 1), _
"\#m\/d\/yyyy\#")
. . .


Richard, it doesn't matter what library a function is in.
If any needed Reference is missing, all bets are off on any
function in every library. You need to make sure that every
referenced library actually is installed and in the same
place on both machines. Because this can be a serious
hassle, you should not reference a library unless there is
no other way to do the job.
--
Marsh
MVP [MS Access]


BruceM wrote:

I don't know why you're having the difficulties you are, so I will leave it
to others to provide guidance on that point, but you may be making this more
difficult than it needs to be. DateSerial will interpret the 0 day of a
month as the last day of the previous month. You could use something like
this:
If Me.NewRecord Then
Me.txtMonthStart =
Format(DateSerial(Year(Date()),Month(Date()),1,"m/d/yyyy")
Me.txtMonthEnd =
Format(Dateserial(Year(Date()),Month(Date())+1,0),"m/d/yyyy")
End If

This assumes that the text boxes txtMonthStart and txtMonthEnd are bound,
and that you want the value to be entered only if it is a new record. I
expect you could use these expressions as the default value of those text
boxes to accomplish the same thing. If your situation differs from these
assumptions the expression can be altered as needed.

"Richard Harison" <noway@xxxxxxxxxxx> wrote
Hello! I need help!
I have written an extensive db and a popup form involves the date
function. I wrote a VB routine that automatically puts the 1st of the
present month into one text box and the last day of the present month in a
second. Here is the key line:
MonthEnd = DatePart("m", BeginningDate) & "/" & LastDay & "/" &
DatePart("yyyy", Date)
(LastDay is derived from an algorithm which returns the correct # of days
in a given month)
I am using Access 2002. When I imported the db to another 2002 computer
the popup form displayed a #NAME error. I found that the problem lay in a
VB library which wasn't active (DAO 3.6 as I recall). I added that
library to references and it worked fine -- on 2002 machines!
Problem now is it will not work in Access 2003. Yet when I look in
references it shows the DAO 3.6 checked.I tried converting the db to 2003,
but the menu says "2002-2003" which says to me that no conversion is
necessary.
Is it possible that the Date function is in another library in 2003?
.



Relevant Pages

  • Re: Bizarre error involving date function
    ... If the user backs out of the record before ... If any needed Reference is missing, all bets are off on any ... VB library which wasn't active (DAO 3.6 as I recall). ... references it shows the DAO 3.6 checked.I tried converting the db to ...
    (microsoft.public.access.formscoding)
  • Re: Bizarre error involving date function
    ... If any needed Reference is missing, all bets are off on any ... This assumes that the text boxes txtMonthStart and txtMonthEnd are bound, ... VB library which wasn't active (DAO 3.6 as I recall). ... references it shows the DAO 3.6 checked.I tried converting the db to 2003, ...
    (microsoft.public.access.formscoding)
  • Re: plasma clouds algorithm ?
    ... come handy on a second stage, once I get to actually create such clouds ... (how the hell do you guys actually pull out an algorithm out of a ... The reference to the book "The Science of Fractal Images" was precious ...
    (sci.fractals)
  • Re: Born again
    ... Bottom line is that I generally give credit ... For example, I probably won't reference ... but Terje's decimal conversion algorithm is probably worthy ... possible solution for each of those 850 routines. ...
    (alt.lang.asm)
  • Re: A race-condition in a SUN paper by Detlefs on reference counting...
    ... The reference count can be dropped to ... being read by LFRCLoad is freed during the execution of LFRCLoad ... "LFRCLoadA is a pointer to a shared memory location that contains a pointer, and p is a pointer to a local pointer variable. ... This implies that the algorithm is strongly thread-safe such that a thread can acquire a reference to an object in a shared location that it previously did not own a reference to. ...
    (comp.programming.threads)