Populating Date field with previous fields Value 
Author Message
 Populating Date field with previous fields Value

Hello,

    This seems simple, however I am probably looking at it incorrectly.  Any
help anyone could provide me would be greatly appreciated.

    I have a subform that has two date fields, a service from date and a
service to date.  If the user enters a date in the service from date field
and enters the next field (which is the service to date field) I would like
it to auto-populate with the service from date.  The code I have works great
upon entering the first record however when adding a completly new record
the service from date field does not receive focus when entering the
subform(I verified the tab order, it is the first tab field) the service to
date field receives the focus and the user has to either use the mouse to
enter the previous field or Shift-Tab to backspace one field.  The only
other code I have on these two fields is that if the service from date field
is null then the focus is shifted out of the subform to the next field on
the main form.  Here is the code I have on those two fields.

Service to date field (if received focus should copy the previous field's
value)

Private Sub det1500todate_GotFocus()
    If Me!det1500frmdate <> "" Then
        Me!det1500todate = Me!det1500frmdate
    End If
End Sub

Service from date (if null then setfocus to next field on main form....
works correctly)

Private Sub det1500frmdate_LostFocus()
    If Me!det1500frmdate.Text = "" Then
        Form_frm15head!txtmemo.SetFocus
    End If
End Sub

Thank You in advance for your assistance.
Scott Myers



Sun, 02 May 2004 01:31:09 GMT  
 Populating Date field with previous fields Value

Not sure I understand the whole problem.

But you want the code to update the Service To Date in the Service From
Date's AfterUpdate event.

Private Sub det1500frmdate_AfterUpdate()
        Me!det1500todate = Me!det1500frmdate
End Sub

-Enjoy
Gary

~~~~~
Improve Global Knowledge, Share yours!


Quote:
> Hello,

>     This seems simple, however I am probably looking at it incorrectly.
Any
> help anyone could provide me would be greatly appreciated.

>     I have a subform that has two date fields, a service from date and a
> service to date.  If the user enters a date in the service from date field
> and enters the next field (which is the service to date field) I would
like
> it to auto-populate with the service from date.  The code I have works
great
> upon entering the first record however when adding a completly new record
> the service from date field does not receive focus when entering the
> subform(I verified the tab order, it is the first tab field) the service
to
> date field receives the focus and the user has to either use the mouse to
> enter the previous field or Shift-Tab to backspace one field.  The only
> other code I have on these two fields is that if the service from date
field
> is null then the focus is shifted out of the subform to the next field on
> the main form.  Here is the code I have on those two fields.

> Service to date field (if received focus should copy the previous field's
> value)

> Private Sub det1500todate_GotFocus()
>     If Me!det1500frmdate <> "" Then
>         Me!det1500todate = Me!det1500frmdate
>     End If
> End Sub

> Service from date (if null then setfocus to next field on main form....
> works correctly)

> Private Sub det1500frmdate_LostFocus()
>     If Me!det1500frmdate.Text = "" Then
>         Form_frm15head!txtmemo.SetFocus
>     End If
> End Sub

> Thank You in advance for your assistance.
> Scott Myers




Sun, 02 May 2004 02:11:47 GMT  
 Populating Date field with previous fields Value
Gary,

This works great however I should have been more clear where the problem
lies.  After the first record is entered into the database and starting a
new record upon leaving the main form the focus is not being set to the
first field in the subform, it is being set to the second field.  I  assumed
that it was my code that was causing this, however we all know what assuming
does.

Thanks Again!!

Scott

Quote:

> Not sure I understand the whole problem.

> But you want the code to update the Service To Date in the Service From
> Date's AfterUpdate event.

> Private Sub det1500frmdate_AfterUpdate()
>         Me!det1500todate = Me!det1500frmdate
> End Sub

> -Enjoy
> Gary

> ~~~~~
> Improve Global Knowledge, Share yours!



> > Hello,

> >     This seems simple, however I am probably looking at it incorrectly.
> Any
> > help anyone could provide me would be greatly appreciated.

> >     I have a subform that has two date fields, a service from date and a
> > service to date.  If the user enters a date in the service from date
field
> > and enters the next field (which is the service to date field) I would
> like
> > it to auto-populate with the service from date.  The code I have works
> great
> > upon entering the first record however when adding a completly new
record
> > the service from date field does not receive focus when entering the
> > subform(I verified the tab order, it is the first tab field) the service
> to
> > date field receives the focus and the user has to either use the mouse
to
> > enter the previous field or Shift-Tab to backspace one field.  The only
> > other code I have on these two fields is that if the service from date
> field
> > is null then the focus is shifted out of the subform to the next field
on
> > the main form.  Here is the code I have on those two fields.

> > Service to date field (if received focus should copy the previous
field's
> > value)

> > Private Sub det1500todate_GotFocus()
> >     If Me!det1500frmdate <> "" Then
> >         Me!det1500todate = Me!det1500frmdate
> >     End If
> > End Sub

> > Service from date (if null then setfocus to next field on main form....
> > works correctly)

> > Private Sub det1500frmdate_LostFocus()
> >     If Me!det1500frmdate.Text = "" Then
> >         Form_frm15head!txtmemo.SetFocus
> >     End If
> > End Sub

> > Thank You in advance for your assistance.
> > Scott Myers




Sun, 02 May 2004 02:22:20 GMT  
 Populating Date field with previous fields Value

Awe, ok... Hmm, Had that problem once, don't remember the solution.

When I remember I'll post it asap.

-Enjoy
Gary

~~~~~
Improve Global Knowledge, Share yours!


Quote:
> Gary,

> This works great however I should have been more clear where the problem
> lies.  After the first record is entered into the database and starting a
> new record upon leaving the main form the focus is not being set to the
> first field in the subform, it is being set to the second field.  I
assumed
> that it was my code that was causing this, however we all know what
assuming
> does.

> Thanks Again!!

> Scott


> > Not sure I understand the whole problem.

> > But you want the code to update the Service To Date in the Service From
> > Date's AfterUpdate event.

> > Private Sub det1500frmdate_AfterUpdate()
> >         Me!det1500todate = Me!det1500frmdate
> > End Sub

> > -Enjoy
> > Gary

> > ~~~~~
> > Improve Global Knowledge, Share yours!



> > > Hello,

> > >     This seems simple, however I am probably looking at it
incorrectly.
> > Any
> > > help anyone could provide me would be greatly appreciated.

> > >     I have a subform that has two date fields, a service from date and
a
> > > service to date.  If the user enters a date in the service from date
> field
> > > and enters the next field (which is the service to date field) I would
> > like
> > > it to auto-populate with the service from date.  The code I have works
> > great
> > > upon entering the first record however when adding a completly new
> record
> > > the service from date field does not receive focus when entering the
> > > subform(I verified the tab order, it is the first tab field) the
service
> > to
> > > date field receives the focus and the user has to either use the mouse
> to
> > > enter the previous field or Shift-Tab to backspace one field.  The
only
> > > other code I have on these two fields is that if the service from date
> > field
> > > is null then the focus is shifted out of the subform to the next field
> on
> > > the main form.  Here is the code I have on those two fields.

> > > Service to date field (if received focus should copy the previous
> field's
> > > value)

> > > Private Sub det1500todate_GotFocus()
> > >     If Me!det1500frmdate <> "" Then
> > >         Me!det1500todate = Me!det1500frmdate
> > >     End If
> > > End Sub

> > > Service from date (if null then setfocus to next field on main
form....
> > > works correctly)

> > > Private Sub det1500frmdate_LostFocus()
> > >     If Me!det1500frmdate.Text = "" Then
> > >         Form_frm15head!txtmemo.SetFocus
> > >     End If
> > > End Sub

> > > Thank You in advance for your assistance.
> > > Scott Myers




Sun, 02 May 2004 05:07:22 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Auto populate form field from previous value in field

2. Copying a previous field's value and pasting it to a later field

3. Criteria set for values in one field based on result of a previous field

4. Pluck Value from Field in Previous Record, Insert in Different Field in NEW Record

5. problem to give a field a value of the previous field

6. Pluck Value from Field in Previous Record, Insert in Different Field in NEW Record

7. How to have a field draw its value from a previous field 4/21 post

8. Populate a Field using value from another field

9. Field won't populate automatically based on the value of another field

10. one field's value populate in another field


 
Powered by phpBB® Forum Software © phpBB Group