Question : Populate form by clicking on a row in a sub form

I have a form which I use to enter data into a table.  On this form is a sub-form which lists all entries in the same table.  Can I set up code which will allow me to populate the fields in the form by clicking on a row in the sub-form?

Thanks

Answer : Populate form by clicking on a row in a sub form

ok ... I get what you are trying to do.

1) Is the ID field displaying on the sub form ?  If so, give that text box a Name of txtID ... then change the code as shown below

2) Is the ID field Numeric ? Or Text ?


Private Sub Form_Current()
    Me.Parent.Form.Filter = "[ID] = " & Me.txtID  ' If ID is Numeric
    '  Me.Parent.Form.Filter = "[ID] = " & Chr(34) & Me.txtID & Chr(34)  ' If ID is text
    Me.Parent.Form.FilterOn = True
End Sub

mx
Random Solutions  
 
programming4us programming4us