PDA

Click to See Complete Forum and Search --> : SQL & VB


Dennis
Jun 7th, 2000, 01:08 PM
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

Ianpbaker
Jun 7th, 2000, 02:58 PM
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

Chris
Jun 7th, 2000, 04:11 PM
[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.


frmAltAddress!StudentID = frmStudentsInfo!StudentID