Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Mar 2004
    Location
    Knoxville, Tennessee, USA
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Changing 'DataSource' Property (VB 6)

    I need to be able to change a Textbox's DateSource property at RunTime by clicking a Command Button. Can this be done? "CLN" is the name of the textbox. Its DataSource in the Property Window is set as adoClients ("Clients" table in my database). On occasion I want to change it to adoIntake ("Intake" table in my database). The DataFields and everything else are identical in the two tables ("Clients" and "Intake").
    So far I have tried the following code written in the "Click" property of the Command Button. CLN.DataSource = adoIntake Unfortunately, neither that code nor its alternative CLN.DataSource = "adoIntake" worked.
    Any suggestions would be greatly appreciated. Thank you!

    Bob Nichols

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Changing 'DataSource' Property (VB 6)

    Since the data source is an object, you need to use the Set keyword. Try

    Set CLN.DataSource = adoIntake

  3. #3
    New Lounger
    Join Date
    Mar 2004
    Location
    Knoxville, Tennessee, USA
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Changing 'DataSource' Property (VB 6)

    As always, thank you Hans!

    Bob

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •