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 / June 2007

Tip: Looking for answers? Try searching our database.

How force Dirty=True from unbound field?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mscertified - 20 Jun 2007 17:51 GMT
I have an unbound combo box that when a selection is made needs to insert a
record to a related table. I can only do this if the record is 'dirty' and my
primary key has been generated. If they click the combo box before this
happens, I need to somehow get the primary key so I can insert the related
record. What is the best way to do this?
Dirk Goldgar - 20 Jun 2007 18:46 GMT
> I have an unbound combo box that when a selection is made needs to
> insert a record to a related table. I can only do this if the record
> is 'dirty' and my primary key has been generated. If they click the
> combo box before this happens, I need to somehow get the primary key
> so I can insert the related record. What is the best way to do this?

You can force the form to become dirty by setting some bound control
equal to its own current value, as in:

   Me!txtMyBoundTextbox = Me!txtMyBoundTextbox

However, if it's a new (unsaved) record and your related table has
referential integrity enforced, you still won't be able to add a record
to the related table until this record has been saved.  In that case,
you may have to somehow defer adding that record until after the form's
record has been saved.

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 
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.