Results 1 to 2 of 2

Thread: 2 tables 2 forms and really stupid 2day

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    2

    Red face

    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

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    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


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