If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Date serial number
Hello to all.
I am trying get the default value of a field to be date and time but in a number (serial?) format. This is to be done in a Private Sub when opened. I have tried MyValue=Date() and DateSerial() but can't seem to get it to work. Any sugestions are welcome. Thanks Gib |
#2
|
|||
|
|||
Date serial number
Define "serial format" and then I'm sure it can be done....probably using
the Format function. -- Ken Snell MS ACCESS MVP "Gib" wrote in message ... Hello to all. I am trying get the default value of a field to be date and time but in a number (serial?) format. This is to be done in a Private Sub when opened. I have tried MyValue=Date() and DateSerial() but can't seem to get it to work. Any sugestions are welcome. Thanks Gib |
#3
|
|||
|
|||
Date serial number
Use the BeforeInsert event of the form to create the string of numbers
representing the text you want. Something like this: Private Sub Form_BeforeInsert(Cancel As Integer) Me.[YourSerialNumber] = Format(Now(), "yyyymmddhhnnss") End Sub The BeforeInsert event fires at the moment you begin adding a new record, so it will receive its value at that moment. -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Gib" wrote in message ... I am trying get the default value of a field to be date and time but in a number (serial?) format. This is to be done in a Private Sub when opened. I have tried MyValue=Date() and DateSerial() but can't seem to get it to work. Any sugestions are welcome. Thanks Gib |
#4
|
|||
|
|||
Date serial number
That did it.
Thanks -----Original Message----- Use the BeforeInsert event of the form to create the string of numbers representing the text you want. Something like this: Private Sub Form_BeforeInsert(Cancel As Integer) Me.[YourSerialNumber] = Format(Now (), "yyyymmddhhnnss") End Sub The BeforeInsert event fires at the moment you begin adding a new record, so it will receive its value at that moment. -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Gib" wrote in message ... I am trying get the default value of a field to be date and time but in a number (serial?) format. This is to be done in a Private Sub when opened. I have tried MyValue=Date() and DateSerial() but can't seem to get it to work. Any sugestions are welcome. Thanks Gib . |
Thread Tools | |
Display Modes | |
|
|