I have Main table and one form with about a dozen fields
I have field which is counter of records which 'opened' on a given date
The openDate is a field in the form and in the table
I originally got the function to work like this
and all was Dandy, But since then ive added some more fields to the table changed the tab order of the form and added some more tables (which are basically to look up and assign Id numbers for various descriptions)
Also I renamed my Table fields to distinguish them from the form fields( i read this was a good idea)
But my Dmax function doesnt work anymore
First: I thought that my additions and changes had caused the problem so I went back to a copy of the mdb file that I saved off just before I figured out the syntax for the dmax function, I added the code (Changing the field names accordingly)as above like I'd done before but It didnt work a 2nd time
Next I tried this:
That sort of works but the counter counts the records that were Created on GetDate() not the records that were opened on DateOpened
Next: I thought I'm gonna have to start from scratch so
I created a new mdb with just 3 fields: Date, text, and counter.
this wouldnt work, i just kept getting 1 as the counter result
but this worked
but is not what i want to count.
im rather green when it comes to access and becoming more confused by the minute
I have field which is counter of records which 'opened' on a given date
The openDate is a field in the form and in the table
I originally got the function to work like this
Code:
Private Sub InputBY_Exit(Cancel As Integer)
Me![3DigitCode] = Nz(DMax("[3DigitCode]", "[Main]", "[DateOpened] = #" & Forms!Main!DateOpened & "#"), 0) + 1
End Sub
Also I renamed my Table fields to distinguish them from the form fields( i read this was a good idea)
But my Dmax function doesnt work anymore
First: I thought that my additions and changes had caused the problem so I went back to a copy of the mdb file that I saved off just before I figured out the syntax for the dmax function, I added the code (Changing the field names accordingly)as above like I'd done before but It didnt work a 2nd time
Next I tried this:
Code:
Private Sub InputBY_Exit(Cancel As Integer)
Me![3DigitCode] = Nz(DMax("[3DigitCode]", "[Main]", "[DateOpened] = Date()"), 0) + 1
End Sub
Next: I thought I'm gonna have to start from scratch so
I created a new mdb with just 3 fields: Date, text, and counter.
Code:
Private Sub Text_Exit(Cancel As Integer)
Me![Counter] = Nz(DMax("[Counter]", "[Main]", "[Date] = #" & Forms!Main!Date & "#"), 0) + 1
End Sub
but this worked
Code:
Private Sub Text_Exit(Cancel As Integer)
Me![Counter] = Nz(DMax("[Counter]", "[Main]", "[Date] = Date()"), 0) + 1
End Sub
im rather green when it comes to access and becoming more confused by the minute
Last edited: