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 2005

Tip: Looking for answers? Try searching our database.

Set controlsource to fieldname

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MN - 29 Apr 2005 21:26 GMT
The textbox HNo1is set to unbound, when the user click to select "I" on combo
box CobDis1 then HNo1 will enable and I want recordsource to be set to fields
name "h_no". How can I do this? Thanks for all respond.

Private Sub CobDis1_AfterUpdate()
Dim rs As DAO.Databases
Set rs = CurrentDb.OpenRecordset("dbo_Case", dbOpenDynaset, dbSeeChanges)
   If Me.CobDis1 = "I" Then
       Me.HNo1.Enabled = True
       Me.HNo1.ControlSource = rs.Field("h_no")
   Else
       Me.HNo1.Enabled = False
   End If
End Sub
Marshall Barton - 29 Apr 2005 23:35 GMT
>The textbox HNo1is set to unbound, when the user click to select "I" on combo
>box CobDis1 then HNo1 will enable and I want recordsource to be set to fields
[quoted text clipped - 10 lines]
>    End If
>End Sub

Set the ControlSource property to a string that's the name
of the field:

    Me.HNo1.ControlSource = "h_no"

Shouldn't also clear the ControlSource when you disable the
control.

OTOH, why are you doing this?  Wouldn't it be just as
effective to just disable the control (or make it
invisible)?

Signature

Marsh
MVP [MS Access]

MN - 02 May 2005 14:36 GMT
Thanks Marshall,
The end user they want Hno1 always disable except when thay select
CobDis1="I" then it is enable.
Also, on screen design they have CobDis2 and HNo2, then they can  select
either CobDis1 or Cobdis2="I" then just 1 of them enable! That tricky for
me...! So you solve the problem for me... thanks a lot.
MN

> >The textbox HNo1is set to unbound, when the user click to select "I" on combo
> >box CobDis1 then HNo1 will enable and I want recordsource to be set to fields
[quoted text clipped - 22 lines]
> effective to just disable the control (or make it
> invisible)?
 
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.