Re: Still need help incrementing a number after resetting it daily to 1
- From: "Rick Brandt" <rickbrandt2@xxxxxxxxxxx>
- Date: Mon, 25 Jul 2005 14:31:32 GMT
Michael wrote:
> Thanks Rick,
> The form is a single view and only one computer will access this
> form, but when I add the code to the default in the properties, I
> get the same error. I tried to add the other code to the before
> update, and I only get a 0 in the NPedana field. I tried to change
> the date on my computer.. but still get a "0"
In these cases you need to "divide and conquer". Open the immediate window
(Control-G) and type...
?Nz(DMax("NPedana", "Registro Entrata", "Day(Del)=Day(Date())"), 0) + 1
<Enter>
....and see if you get an error or the correct response. If you don't get
the correct response strip something out of the expression to simplify it
and try again. For example, I would first eliminate the WHERE clause from
the DMax() to see if that is the problem...
?Nz(DMax("NPedana", "Registro Entrata"), 0) + 1 <Enter>
Does this work? If so, then you know that the WHERE clause is the problem.
Actually in looking at this I see a different problem anyway. You should
not be using Day() because that just returns the day of the month which will
not work. You need to compare the actual dates. What should work is...
?Nz(DMax("NPedana", "Registro Entrata", "DateValue(Del)=Date()"), 0) + 1
<Enter>
If the field [Del] has no time component stored then the DateValue()
function would not be required and you could just use...
?Nz(DMax("NPedana", "Registro Entrata", "Del = Date()"), 0) + 1 <Enter>
Be careful not to be confused by formatting here. How you have Del
formatted has no bearing on whether a time component is stored or not. It
has to do with whether it is populated by using Date() or Now(). If there
is no time vaue stored (actually a time of midnight) then the expression
without the DateValue() funstion will be more efficient. You should also
apply an index to this field.
Try the above and see if you have any success.
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
.
- References:
- Still need help incrementing a number after resetting it daily to 1
- From: Michael
- Re: Still need help incrementing a number after resetting it daily to 1
- From: Rick Brandt
- Re: Still need help incrementing a number after resetting it daily to 1
- From: Michael
- Re: Still need help incrementing a number after resetting it daily to 1
- From: Rick Brandt
- Re: Still need help incrementing a number after resetting it daily to 1
- From: Michael
- Still need help incrementing a number after resetting it daily to 1
- Prev by Date: Requery problem with combos on a continuous subform
- Next by Date: Re: More issues with forms/subforms
- Previous by thread: Re: Still need help incrementing a number after resetting it daily to 1
- Next by thread: Wrong information arriving in table.
- Index(es):
Relevant Pages
|