A Subform Conundrum

  • Thread starter Thread starter Dwayne Conyers
  • Start date Start date
D

Dwayne Conyers

We have a form that displays data in a record.

We have a subform that displays all records from the foreign table where the
index on the subform matches the key on the main form.

It displays correctly for the first record but when paging through data we
get blanks.

Any ideas?

TIA
 
Thought I would forego the interface and try coding to get the subform to
update. So I create this subroutine that is called whenever a data
navigation event is triggered -- although it only serves to highlight the
contents of the subform -- still doesn't show records with main_key higher
than "1":

Private Sub updateIMBStaffNotes()

Dim mySQL As String
Dim iRecord As Integer

iRecord = Me.txtid.Value

If iRecord > 0 Then

mySQL = "SELECT [imb_staff_notes Query].Notes, "
mySQL = mySQL & "[imb_staff_notes Query].Author, "
mySQL = mySQL & "[imb_staff_notes Query].Entered, "
mySQL = mySQL & "[imb_staff_notes Query].main_key "
mySQL = mySQL & "FROM [imb_staff_notes Query] "
mySQL = mySQL & "WHERE [imb_staff_notes Query].main_key = " &
Me.txtid.Value & ";"

Me.IMB_Staff_Notes.Form.RecordSource = mySQL
Me.IMB_Staff_Notes.Form.Requery
'Me.IMB_Staff_Notes.Form.Recalc

End If

End Sub
 
Back
Top