Results 1 to 5 of 5

Thread: adodc simple question

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Posts
    1,384

    adodc simple question

    I have a combo box (cboNumber), when something is selected in the combo box I want to update the form accordingly.

    cboNumber, txtName and txtCompany are all linked to adoData, therefore when something is selected in cboNumber I want txtName and txtCompany to be updated.

    I have tried:

    Private Sub cboNumber_Change()

    adoData.Refresh

    End Sub
    but keep gettin a system error, which closes the application

    I know it's a simple query, HELP.
    Mel

  2. #2
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    Code:
    Public Sub cboNumber Click()
    adoData.CommandType = adCmdText
    adoData.RecordSource ("SELECT * FROM table1 WHERE field1 = '" & cboNumber.Text '")
    adoData.Refresh
    See how this works.
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  3. #3
    Junior Member
    Join Date
    Apr 2002
    Posts
    24
    Ok, so when you select something (ID Number?) in the combo box, you want it to go to the record and show the associated name and company?

    I'll just throw this out there, though I could be way off track:

    Code:
    adoData.Recordsource = "SELECT Name, Company FROM TableName WHERE ID = '" & cboNumber.Text & "'"
    
    adoData.Refresh
    Where "Name" and "Company" are field names in your table called "TableName".

    You may have a problem with your combo box being bound to your data control.

    Anyway, it's a start.

    **EDIT** Sigh, his is better above...

    --Dador

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Posts
    1,384
    Thanks but I had tried that already and the ame thing is happening

    When I go to chande the cboNumber it just bums me out of the application
    Mel

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Posts
    1,384
    Actually when I have:
    strSearch= "Select * From Table1 WHERE NumNo = '" & _
    cboNumber.Text & "'"
    With adoData
    .RecordSource = strSearch
    .Refresh
    End With
    I keep getting a Data Mismatch in Criteria Expression Error.

    When I have:
    adoData.Refresh
    The System bums out

    PHP Code:
    imelda 
    Mel

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