changing the datasource property of a text box at run time

changing the datasource property of a text box at run time

Post by Chris Woodro » Tue, 26 Mar 1996 04:00:00



Why can't the data source property of a text box be changed at run time?
 Are there any third party text boxes which allow this?

Chris Woodrow

 
 
 

1. Retreiving the DataSource Property at run-time.

I need to be able to retreive the DataSource property of a
Database bound control so that I can read other properties
about the data field of that control so that I can validate
the data in that control.

Code Example:

Public Function Validate_Data_Control(Source_Control As Control) As Boolean
   Dim Field_Type%
   Dim Field_Name$
   Dim Required As Boolean, Can_Be_Null As Boolean
   Dim Parent_Data_Control As Control

   ' Get Properties about Database Field this control is Bound to
   Parent_Data_Control = Source_Control.DataSource
   Field_Name = Source_Control.DataField
   Field_Type = Parent_Data_Control.Recordset(Field_Name).Type
   Required = Parent_Data_Control.Recordset(Field_Name).Required
   Can_Be_Null = Parent_Data_Control.Recordset(Field_Name).AllowZeroLength

The above code sample will not work because the Datasource
property cannot be retreived.  

I would expect "Parent_Data_Control" to Hold the Data
control for the Database bound control but it has the
value of "Object Variable not set" as it should
since the help topic for DataSource states it is
unavailable at Run-Time.

I can get the Datafield property which tells me which
field the control refers to but I need the DataSource
property which would return me the Data Control which
would have DatabaseName property to tell me the location
of the database and the RecordSource Property.  
I could pass these as extra parameters but then I have
to change code (The Parameters) along with changing the
properties of the control when the field the control is
bound to changes.

I need an indirect way to retreive this property.  
If anyone could help I would greatly appreciate it.

Thanks,

Edward Willis


2. DECODE statement: is this a reasonable way to do things?

3. how to set msflexgrid datasource property at run time

4. How can I view the definition of an existing trigger?

5. changing datasource at run-time

6. 19180-Nationwide-C++-ORACLE-Java-Data Modeling-GUI-Integration-Process and Workf

7. True DBGrid (Changing Header properties at run time)

8. Complicated SQL Problem...

9. Changing Locked Property in Access 2.0 During Run Time

10. changing graph properties at run time

11. Changing Userconnection properties at run time.

12. Changing Connection Properties At Run Time (T-SQL)

13. Run-Time Error 383, Text Property Read Only