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

Tip: Looking for answers? Try searching our database.

Default Value

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sandra P - 19 Oct 2007 19:23 GMT
I have the following two fields (among others) on my form:

1.  Checkbox called "Script Required?"

2.  Combo box with a choice of services.

Some services require scripts and others do not.  The default value for the
checkbox is yes since more do than don't.  What I would like is that if the
service choice from the combo box does not require a script, then the
checkbox converts to no.  Is that possible?

Thanks,

Sandra
Dennis - 19 Oct 2007 19:30 GMT
In the ON CHANGE event of your combo-box, insert code similar to:

Select Case CombBoxValue
  Case This, That, SomethingElse
     Me.Checkbox = 0
  Case Else
     Me.Checkbox = -1
End Select

Fiddle with it a bit, but that's essentially what you need. Be sure to
single-step through the code to make sure the CASE works for all values.

> I have the following two fields (among others) on my form:
>
[quoted text clipped - 10 lines]
>
> Sandra
Steve Sanford - 21 Oct 2007 22:56 GMT
If the Row Source of the combo box is a query, you can add a field (Y/N -
boolean) to the table that would indicate if the service needs a script.

If you want to know if a service needs a script, query the table. There is
no chance of someone accidently changing the state of the checkbox.

If you still want to keep the checkbox, it can set it using the column
property.

If the combo box row source fields were

lngServicesID (PK) (long)
txtServiceDesc  (text)
ynScriptRequired (boolean)

and the control names are RequireScript (check box) and cboService (combo box)

then the checkbox could be set/unset using

Sub cboService_Afterupdate()
 ' the column property is zero based. The first column is numbered 0
  Me.RequireScript = Me.cboService.Column(2)
End Sub

Just another way to remove the cat from its skin

HTH
Signature

Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)

> I have the following two fields (among others) on my form:
>
[quoted text clipped - 10 lines]
>
> Sandra
 
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.