Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: The control sorce by code


Message #1 by "Ahmed Khamis" <Ahmed.Khamis@v...> on Fri, 27 Sep 2002 13:26:22 +0200
Good day all,

	How can I set the control source of any field by the VB code.


Best regards, 

Ahmed Khamis
Vodafone Egypt
Customer operation
Mob:  xxx-xxx-xxxx
Ext:56-1179
Ahmed.khamis@v...


Message #2 by "Gregory Serrano" <SerranoG@m...> on Fri, 27 Sep 2002 12:58:50
Ahmed,

<< How can I set the control source of any field by the VB code. >>

There is a property called .ControlSource that you can read and set.  For 
a textbox it would be something like Me.txtTextBoxName.ControlSource to 
reference it.

Greg
Message #3 by "Ahmed Khamis" <Ahmed.Khamis@v...> on Fri, 27 Sep 2002 14:07:33 +0200
Thanx but could u show me how can I link the field to the table
Assuming the filed call A and the tables is b




Best regards,

Ahmed Khamis
Vodafone Egypt
Customer operation
Mob:  xxx-xxx-xxxx
Ext:56-1179
Ahmed.khamis@v...

-----Original Message-----
From: Gregory Serrano [mailto:SerranoG@m...]
Sent: Friday, September 27, 2002 2:59 PM
To: Access
Subject: [access] Re: The control sorce by code

Ahmed,

<< How can I set the control source of any field by the VB code. >>

There is a property called .ControlSource that you can read and set.  
For
a textbox it would be something like Me.txtTextBoxName.ControlSource to
reference it.

Greg
Message #4 by "Gregory Serrano" <SerranoG@m...> on Fri, 27 Sep 2002 13:38:19
<< Thanx but could u show me how can I link the field to the table
Assuming the filed call A and the tables is b >>

tblTableB is the table
strFieldA is the field in the table
txtFieldA is the textbox on the form

Do program it all in code, you have a form.  On it's "On Open" event you 
type:

   Me.RecordSource = "tblTableB"
   Me.txtFieldA.ControlSource = "strFieldA"

The first line sets the form's row record source to the table.  The second 
line sets the textbox's control source to the field in that table.


Greg

  Return to Index