Connecting Tech Pros Worldwide Forums | Help | Site Map

How can i make a fiels reset on every date change,and auto increasing?

marko
Guest
 
Posts: n/a
#1: Nov 13 '05
Here is my problem.
How can i make a field in a form change to a value 1 every morning when
I turn access on, when the date changes?
And how can i make a button on a form which would open another form and
increase the value of one field by 1. The first value of that field
would be 1(from the morning and increasing through the day) and it
would fill in automatically from the last record and then i would push
that button. It would increase that value by one, open another form and
go to the next record.
Please help!
Thanks,

Marko Svaco


King Ron
Guest
 
Posts: n/a
#2: Nov 13 '05

re: How can i make a fiels reset on every date change,and auto increasing?


for Question1: date stamp each row as it's created with the current
date, then create a vb function that counts the number of records
previously entered with the 'Current' date + 1 and set your counter
field to that value.

Each time you enter a new row, call this routine.

<uncompiled code>

MyForm.CreateDate = Date()
MyForm.MyCounterField = GetDayCount(Date())
Me.Refresh

Public Function GetDayCount(InDate as Date) as Long
GetDateCount = DCount("MyTable","[CreateDate] = #" & InDate & "#") +
1
End Function

</uncompiled code>

King Ron of Chi

Closed Thread


Similar Microsoft Access / VBA bytes