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 / New Users / April 2006

Tip: Looking for answers? Try searching our database.

trouble with default value for a control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dbnDavid - 27 Apr 2006 13:38 GMT
I have a form frmClntsAgents for which the Record Source is qryAgents which
filters the table tblGlobalClnts for the value “agent” in the ClientType
field in a related table tblClientType  -  tblClientType has two fields:
ClientTypeID and ClientType.

A combo box control cboClientType on the form allows the value “agent” to be
selected from the drop-down list. And this works fine. But I want to automate
things by making “agent” both the default value for this control AND have
that default value entered in the control each time a new record is added.
Then I can simply hide the control and let the value be entered behind the
scenes for new records.

But I can’t get this to work. The combo box is fine, but I can’t get the
control to automatically pick up the default value.

I’d like to try some sort of Event expression for the control but I’m not
sure where it should go, and I don’t yet know enough VBA to write the code.

Any suggestions gratefully received!
Jeff Boyce - 27 Apr 2006 13:47 GMT
If you want:
 * every record to hold the ClientTypeID for "agent"
 * no ability to select another type
why bother even having a combo box?  You could add a (hidden) text box on
your "agents-only" form and use a default value of the ClientTypeID.  All
newly-created records would have that value.

To update the old records that need it, you could create an update query
(but I'm not sure how you'd know which ones were "agents"?<g>).

Signature

Regards

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/

> I have a form frmClntsAgents for which the Record Source is qryAgents which
> filters the table tblGlobalClnts for the value “agent” in the ClientType
[quoted text clipped - 15 lines]
>
> Any suggestions gratefully received!
dbnDavid - 27 Apr 2006 14:51 GMT
Thanks Jeff, that solves my problem. It's working fine now.

I did try this before but my mistake was to try to get the control to
default to the display field "ClientType" rather than the actual bound field
ClientTypeID.
 
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.