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
|
|||
|
|||
Inputing a reusable value on a form (batching)
I have a form that I use to ADD new time sheets for a given time period. One
field I use is a "Period Ending Date"[PEDATE]. This date is the same for all of the time sheets and I would like to only input it ONCE when the form opens and have it automatically fill end that date in the [PEDATE] field for all of the time sheets that I add for that session. I would also like to skip that field when I'm inputing the rest of the data. -- Ameteur Access 2000 User Thanks Bobbye |
#2
|
|||
|
|||
Inputing a reusable value on a form (batching)
To use the last entered date as the default for new records, set the text
box's Default Value in its After Update event procedure. DefaultValue is a string value, so the code would be something like this: Private Sub PEDATE_AfterUpdate() With Me.PEDATE If Not IsNull(.Value) Then .DefaultValue = "=""" & .Value & """" .TabStop = False End If End With End Sub Setting its TabStop property to No means it is skipped once the value has been set. If the PEDate is the same for all records, would it be a better design to create a little table to hold the BatchNum and PeriodEndDate, and have a BatchNum instead of a PEDate? It seems to me that this would be more reliable and more flexible (e.g. to undo a batch.) -- 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. "Bobbye" wrote in message ... I have a form that I use to ADD new time sheets for a given time period. One field I use is a "Period Ending Date"[PEDATE]. This date is the same for all of the time sheets and I would like to only input it ONCE when the form opens and have it automatically fill end that date in the [PEDATE] field for all of the time sheets that I add for that session. I would also like to skip that field when I'm inputing the rest of the data. -- Ameteur Access 2000 User Thanks Bobbye |
#3
|
|||
|
|||
Inputing a reusable value on a form (batching)
Thanks Allen. It worked.
I'm an old dbase user and I find access concepts much more difficult to grasp. I just didn't want to have to manually enter the date more than once a session. (The time sheets come in over a two weeks period and different people may enter the info and sometimes enter the wrong period ending date and I end up with bad stored info.) I have another question. The pay period is always on the 10th and the 25th of the month. Is there some way I can be sure the user only enters one or the other "day"? Also, is there a way to "warn" the user that the date on a job sheet [jobdate] is from another pay period but still let them enter it? (Sometimes it's a typing error but sometimes the guys turn them in late.) -- Ameteur Access 2000 User Thanks Bobbye "Allen Browne" wrote: To use the last entered date as the default for new records, set the text box's Default Value in its After Update event procedure. DefaultValue is a string value, so the code would be something like this: Private Sub PEDATE_AfterUpdate() With Me.PEDATE If Not IsNull(.Value) Then .DefaultValue = "=""" & .Value & """" .TabStop = False End If End With End Sub Setting its TabStop property to No means it is skipped once the value has been set. If the PEDate is the same for all records, would it be a better design to create a little table to hold the BatchNum and PeriodEndDate, and have a BatchNum instead of a PEDate? It seems to me that this would be more reliable and more flexible (e.g. to undo a batch.) -- 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. "Bobbye" wrote in message ... I have a form that I use to ADD new time sheets for a given time period. One field I use is a "Period Ending Date"[PEDATE]. This date is the same for all of the time sheets and I would like to only input it ONCE when the form opens and have it automatically fill end that date in the [PEDATE] field for all of the time sheets that I add for that session. I would also like to skip that field when I'm inputing the rest of the data. -- Ameteur Access 2000 User Thanks Bobbye |
#4
|
|||
|
|||
Inputing a reusable value on a form (batching)
You can test the Day() of the date, e.g.:
If (Day(Me.PEDATE) 10) AND (Day(Me.PEDATE) 25) Then ... Likewise, you can test whether the date is before the beginning of the current pay period, e.g.: If Me.PEDate DateSerial(Year(Date), Month(Date), 10) Then -- 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. "Bobbye" wrote in message ... Thanks Allen. It worked. I'm an old dbase user and I find access concepts much more difficult to grasp. I just didn't want to have to manually enter the date more than once a session. (The time sheets come in over a two weeks period and different people may enter the info and sometimes enter the wrong period ending date and I end up with bad stored info.) I have another question. The pay period is always on the 10th and the 25th of the month. Is there some way I can be sure the user only enters one or the other "day"? Also, is there a way to "warn" the user that the date on a job sheet [jobdate] is from another pay period but still let them enter it? (Sometimes it's a typing error but sometimes the guys turn them in late.) -- Ameteur Access 2000 User Thanks Bobbye "Allen Browne" wrote: To use the last entered date as the default for new records, set the text box's Default Value in its After Update event procedure. DefaultValue is a string value, so the code would be something like this: Private Sub PEDATE_AfterUpdate() With Me.PEDATE If Not IsNull(.Value) Then .DefaultValue = "=""" & .Value & """" .TabStop = False End If End With End Sub Setting its TabStop property to No means it is skipped once the value has been set. If the PEDate is the same for all records, would it be a better design to create a little table to hold the BatchNum and PeriodEndDate, and have a BatchNum instead of a PEDate? It seems to me that this would be more reliable and more flexible (e.g. to undo a batch.) "Bobbye" wrote in message ... I have a form that I use to ADD new time sheets for a given time period. One field I use is a "Period Ending Date"[PEDATE]. This date is the same for all of the time sheets and I would like to only input it ONCE when the form opens and have it automatically fill end that date in the [PEDATE] field for all of the time sheets that I add for that session. I would also like to skip that field when I'm inputing the rest of the data. -- Ameteur Access 2000 User Thanks Bobbye |
#5
|
|||
|
|||
Inputing a reusable value on a form (batching)
Allen, thanks again. I noticed you have a tips website. I'm sure I'll find
it helpful in the future. -- Ameteur Access 2000 User Thanks Bobbye "Allen Browne" wrote: You can test the Day() of the date, e.g.: If (Day(Me.PEDATE) 10) AND (Day(Me.PEDATE) 25) Then ... Likewise, you can test whether the date is before the beginning of the current pay period, e.g.: If Me.PEDate DateSerial(Year(Date), Month(Date), 10) Then -- 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. "Bobbye" wrote in message ... Thanks Allen. It worked. I'm an old dbase user and I find access concepts much more difficult to grasp. I just didn't want to have to manually enter the date more than once a session. (The time sheets come in over a two weeks period and different people may enter the info and sometimes enter the wrong period ending date and I end up with bad stored info.) I have another question. The pay period is always on the 10th and the 25th of the month. Is there some way I can be sure the user only enters one or the other "day"? Also, is there a way to "warn" the user that the date on a job sheet [jobdate] is from another pay period but still let them enter it? (Sometimes it's a typing error but sometimes the guys turn them in late.) -- Ameteur Access 2000 User Thanks Bobbye "Allen Browne" wrote: To use the last entered date as the default for new records, set the text box's Default Value in its After Update event procedure. DefaultValue is a string value, so the code would be something like this: Private Sub PEDATE_AfterUpdate() With Me.PEDATE If Not IsNull(.Value) Then .DefaultValue = "=""" & .Value & """" .TabStop = False End If End With End Sub Setting its TabStop property to No means it is skipped once the value has been set. If the PEDate is the same for all records, would it be a better design to create a little table to hold the BatchNum and PeriodEndDate, and have a BatchNum instead of a PEDate? It seems to me that this would be more reliable and more flexible (e.g. to undo a batch.) "Bobbye" wrote in message ... I have a form that I use to ADD new time sheets for a given time period. One field I use is a "Period Ending Date"[PEDATE]. This date is the same for all of the time sheets and I would like to only input it ONCE when the form opens and have it automatically fill end that date in the [PEDATE] field for all of the time sheets that I add for that session. I would also like to skip that field when I'm inputing the rest of the data. -- Ameteur Access 2000 User Thanks Bobbye |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Customers- Contracts form problem | GL | Using Forms | 10 | February 7th, 2006 04:05 PM |
Move feild entries from form to form using global variables | JackCGW | General Discussion | 11 | November 14th, 2005 05:22 AM |
Tell if Form is a Dialog | Alex | Using Forms | 7 | August 30th, 2005 06:22 PM |
ECHO Causing Problems | DS | General Discussion | 5 | May 17th, 2005 02:19 AM |
auto entry into second table after update | Tony | New Users | 13 | July 9th, 2004 10:42 PM |