Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / September 2008

Tip: Looking for answers? Try searching our database.

Auto Fill

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
zyus - 02 Apr 2008 08:13 GMT
I hv this tbl structure that i key in thru form

No  Recdate      Amt
1    02-04-08     500.00
2    02-04-08     500.00

Want to know how to auto default the date & amt on 2nd record and it will
follow the same date & amt  entered on the 1st record...Of course user can
amend the date/value....TQ
Klatuu - 02 Apr 2008 15:21 GMT
Use the form's After Upate event to populate the  Default Value property of
the controls you want to carry forward:

   Me.MyControl.DefaultValue = Me.MyControl
Signature

Dave Hargis, Microsoft Access MVP

> I hv this tbl structure that i key in thru form
>
[quoted text clipped - 5 lines]
> follow the same date & amt  entered on the 1st record...Of course user can
> amend the date/value....TQ
John F. - 24 Sep 2008 06:15 GMT
I have a form which opens records on a table; I use the "Add New" button on
the navigator to open a new record. Even though I use the following code in
the form's After_Update event,the default values are not added. In fact, when
I add the new record, the program doesn't seem to 'step into' the form's
After_Update event at all (at least, a breakpoint inserted at, say
"Me.tbAdmitdate" never halts the program's execution.)

Private Sub Form_AfterUpdate()
   Me.tbRecNum.DefaultValue = Me.tbRecNum
   Me.tbAdmitdate.DefaultValue = Me.tbAdmitdate
   Me.tbServicedate.DefaultValue = DateAdd("d", 1, Me.tbServicedate.Value)
'add a day to get next servicedate automatically
   
End Sub

Could you please explain this behaviour and suggest a different way of
getting the default values inserted?

Thank you.

johno



> Use the form's After Upate event to populate the  Default Value property of
> the controls you want to carry forward:
[quoted text clipped - 10 lines]
> > follow the same date & amt  entered on the 1st record...Of course user can
> > amend the date/value....TQ
Klatuu - 24 Sep 2008 14:35 GMT
The After Update event doesn't fire until you try to close the form, change
to a different record which includes adding a new record, or take some action
to explicitly save the record.
Using the technique you are using does work, but you will not actually see
the values on the form until you begin entering data in the new record.
Signature

Dave Hargis, Microsoft Access MVP

> I have a form which opens records on a table; I use the "Add New" button on
> the navigator to open a new record. Even though I use the following code in
[quoted text clipped - 34 lines]
> > > follow the same date & amt  entered on the 1st record...Of course user can
> > > amend the date/value....TQ
John F. - 25 Sep 2008 02:05 GMT
Hi, Klatuu:

I still seem to have the problem. I even removed the default value from the
fields in the table designer, to avoid any interference with the values I'm
tryng to replicate. I'm still suspicious that the program break doesn't
happen during the form's After_Update event -- shouldn't that happen any time
that the program is stepping into that event?

Best,

johno

> The After Update event doesn't fire until you try to close the form, change
> to a different record which includes adding a new record, or take some action
[quoted text clipped - 40 lines]
> > > > follow the same date & amt  entered on the 1st record...Of course user can
> > > > amend the date/value....TQ
Klatuu - 25 Sep 2008 14:51 GMT
It just dawned on me what the problem may be.  The After Update event does
not fire unless you make a change to a record.  In other words, you have to
dirty the form.  So if you are on record A, but make no changes and click the
button to add a new record, the After Update event does not fire.

What you might try is putting the same code in the form's Current event.  
That way, as soon as record A becomes the current record, its values will be
loaded as the default values.  But you still need the code in the after
update event so that if one of the values changes, the default value will
also change.

I would suggest you move the code to set the default values to a sub and
call the sub from the form currrent and after update events.

Signature

Dave Hargis, Microsoft Access MVP

> Hi, Klatuu:
>
[quoted text clipped - 52 lines]
> > > > > follow the same date & amt  entered on the 1st record...Of course user can
> > > > > amend the date/value....TQ
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.