Results 1 to 3 of 3

Thread: SQL & VB

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Posts
    5

    Question

    I am building an application w/VB 6.0 and I am using SQL 7.0 Having some trouble with bringing up a form titled AltAddress with a ID# that matches with the form StudentsInfo ID#. Can do it in Access 97/2000 but I can't seem to make it work in this VB App. AltAddress form comes up when the button is clicked on the StudentsInfo form but the ID# numbers do not match and the SELECT (other fields do not match either) Anyway if you can help it would be wonderful.

    This is what I been trying

    Private Sub cmdAltAddress_Click()

    ' This code created in part by Command Button Wizard.
    'On Error GoTo Err_cmdAltAddress_Click


    ' Open form frmAltAddress in data edit mode.
    Load frmAltAddress
    'Set recordsource to StudnetID
    frmAltAddress.sqlaltaddress.RecordSource = "SELECT * FROM tblAltAddress INNER JOIN tblStudentsInfo ON tblAltAddress.StudentID = tblStudentsInfo.StudentID"

    ' Set StudentID in control box on form AltAddress to value in
    ' control on frmStudentsInfo.
    [frmAltAddress]!StudentID = [frmStudentsInfo]!StudentID
    frmAltAddress.Show
    End Sub

  2. #2
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696

    Lightbulb

    Hi Dennis

    try replacing the
    [frmAltAddress]!StudentID = [frmStudentsInfo]!StudentID

    to

    frmAltAddress.StudentID = frmStudentsInfo.StudentID


    If I remember correctly VB doesn't like The !


    Hope This helps

    Ian
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  3. #3
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Lightbulb What version of VB that you using?

    [frmAltAddress]!StudentID = [frmStudentsInfo]!StudentID
    I think in older version of Visual Basic (If not mistaken I think is Version Basic 4.0) we can use ! but may be in this was? Hope it was correct.

    Code:
    frmAltAddress!StudentID = frmStudentsInfo!StudentID

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