A Subform Conundrum

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
 
D

Dwayne Conyers

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top