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 Programming / May 2007

Tip: Looking for answers? Try searching our database.

Default value

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Daniel - 31 May 2007 14:48 GMT
Hello all,

I have a form with a date control which has as it's default value =Date().  
How can I, using VBA, dirty the record using the default value if a user
enter a value in the subform without entering any other info in the main form?

Normally, the default value appears but doesn't get associated to the record
until another control is dirtied on the main form.  So how can I dirty the
date control if my users go directly into the subform and make an entry?

(Using Access 2000)

Thank you for the help,

Daniel P
Jeff Boyce - 31 May 2007 15:08 GMT
Daniel

I may be missing something...

In a typical main form/subform design, the main form holds "parent" record
data, while the subform holds "child" data record(s) related to the parent
record.  Thus, it would be very unusual to go directly to a subform, since
there would be NO parent record it could relate to.

If you need to associate the current date (Date()) with each subform record,
you don't need a main form to do that.  You could add a CurrentDate field to
the table underlying your subform and use a default-valued control in that
(sub)form.  And you wouldn't need to embed it in a main form, so it would
become a (no-longer-sub)form in its own right.

Signature

More info, please ...

Jeff Boyce
Microsoft Office/Access MVP
http://mvp.support.microsoft.com/

Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

Microsoft Registered Partner
https://partner.microsoft.com/

> Hello all,
>
[quoted text clipped - 11 lines]
>
> Daniel P
Marshall Barton - 31 May 2007 15:25 GMT
>I have a form with a date control which has as it's default value =Date().  
>How can I, using VBA, dirty the record using the default value if a user
[quoted text clipped - 3 lines]
>until another control is dirtied on the main form.  So how can I dirty the
>date control if my users go directly into the subform and make an entry?

It seems strange that you don't need any data in the main
form's new record before adding related records in the
subform.  I would expect your question to be how to prevent
users from entering subform data until after meaninful data
has been entered in the main form new record.

With that said, you can dirty a record by assigning any
value to any bound control:
    Me.someboundcontrol = somevalue

Signature

Marsh
MVP [MS Access]

Daniel - 31 May 2007 16:48 GMT
Normally I would agree.  This is a very particular request where they wish to
be able to do mass processing when things are very busy and then come back
and fill in the missing data later.  They normally would have had to enter
the date manually and this would have created the record instance so that
when they went on into the subform all would have been fine, but in my trying
to simplify their lives, I created a default value for the date they now jump
right into the subform and ... the question.

thank you so very much
--
Daniel P

> >I have a form with a date control which has as it's default value =Date().  
> >How can I, using VBA, dirty the record using the default value if a user
[quoted text clipped - 13 lines]
> value to any bound control:
>     Me.someboundcontrol = somevalue
Marshall Barton - 31 May 2007 18:28 GMT
>Normally I would agree.  This is a very particular request where they wish to
>be able to do mass processing when things are very busy and then come back
[quoted text clipped - 3 lines]
>to simplify their lives, I created a default value for the date they now jump
>right into the subform and ... the question.

How is a parent record linked to its child records?  Without
some data, it seems like the child records are not related
to anything.  If the child records are linked to the main
record on the date field, then I suggest that you set the
date field's value instead of using the DefaultValue.  (But,
that raises the question about what to do if no child
records are ever created.)

Signature

Marsh
MVP [MS Access]

 
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.