Results 1 to 2 of 2

Thread: cannot bind field error

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Columbia, SC USA
    Posts
    374

    Angry

    I have a form with an ADODC and some text boxes. If I set the ADODC's properties and the text box DataSource and DataField at design time, it runs fine. But I need to set them at run time since I employ temporary tables elsewhere in the code.

    The code
    Code:
    Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & frmSICC.CadenaConexión & ";Persist Security Info=False"
    
    Adodc1.RecordSource = "Select LAST_NAME, FIRST_NAME, CODE From Personnel Where IdCONTACT_CLASS = 'EMERGENCY' Order By LAST_NAME, FIRST_NAME"
    
    Set LastName.DataSource = Adodc1
    txtLastName.DataField = Adodc1.Recordset.Fields("LAST_NAME")
    gives me the runtime error 545
    "Unable to bind field or data member " and then the value of the first record's LAST_NAME field

    Any ideas why this is so? Thanks,

    Andrew

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Columbia, SC USA
    Posts
    374

    Talking Never Mind!

    Found it myself through trial and error. Correct code:

    Code:
    Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & frmSICC.CadenaConexión & ";Persist Security Info=False"
    
    Adodc1.RecordSource = "Select LAST_NAME, FIRST_NAME, CODE From Personnel Where IdCONTACT_CLASS = 'EMERGENCY' Order By LAST_NAME, FIRST_NAME"
    
    Set LastName.DataSource = Adodc1
    txtLastName.DataField = "LAST_NAME"

Posting Permissions

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



Click Here to Expand Forum to Full Width