PDA

Click to See Complete Forum and Search --> : 2 tables 2 forms and really stupid 2day


pcmaloney
Jul 5th, 2000, 01:08 PM
I have a form for table1 with PK and a form for table2 with FK. I pull records from table1 and onClick want fields in form for table2 to populate based on PK from table1. Both forms are MDIChild.

(Frm1)

Private Sub cmdCourses_Click()
progField = txtField(1)
MyRs.Close
strSQL = "SELECT * FROM table2 WHERE FK = '" & progField & "'"

Set MyRs = New ADODB.Recordset
MyRs.Open strSQL, MyConn, adOpenDynamic, adLockOptimistic

frmTable2.Text1.Text = MyRs.Fields(0).Value
frmTable2.Show

End Sub

Can anyone help, I'm brain dead 2day

Clunietp
Jul 5th, 2000, 11:23 PM
try using:

progField = CSTR(txtField(1))

sometimes if a number is in a text box, you won't get the correct value of the value in the field