GaryCanuck
Technical User
Hi all,
I'm running access 2007. I have a form with two subforms that make up a client index. On one of the subforms I have an autonumber field where the field is populated with the value on the double click event. It works as desired most of the time but under certain circumstances it produces a runtime error. They both have to do with creating a new record (using the row with the star). Errors happen when:
1) the double click is the first thing you do in the new record
2) if you click in the new record row (even without typing anything) and then double click in an old row
Both seem peculiar to me. I guessing they're related to nulls somehow but I'm not sure what to do about it, or where to start. Any ideas? Thanks as always. The double click event code is below.
I'm running access 2007. I have a form with two subforms that make up a client index. On one of the subforms I have an autonumber field where the field is populated with the value on the double click event. It works as desired most of the time but under certain circumstances it produces a runtime error. They both have to do with creating a new record (using the row with the star). Errors happen when:
1) the double click is the first thing you do in the new record
2) if you click in the new record row (even without typing anything) and then double click in an old row
Both seem peculiar to me. I guessing they're related to nulls somehow but I'm not sure what to do about it, or where to start. Any ideas? Thanks as always. The double click event code is below.
Code:
NexKey = Format(1 + Nz(DMax("Val(Right([Open#],3))", "File", "[Client#] = Forms!Client![Client#]")), "000")
[Open#].Value = [Client#].Value & NexKey
[OpenDate].Value = Format(Date, "mm/d/yyyy")