Search Form won't open correct record

T

tompk

Like many others, I have been using Allan Browne's search form for oodles of
searches and it works great. For some reason, on this one Search, it only
opens a blank copy of the form instead of the form with the Oblig_ID that is
selected.

I believe that all I changed was the ID and the Form name however, this is
the only instance where I have a many-to-many relationship. I've tried
changing this to Me.Oblig_ID and [Subtbl_Obligations_MAIN].[Oblig_ID] and
neither works. Can anyone tell me where my error is? Thanks a lot!

Private Sub List_Results_DblClick(Cancel As Integer)
'Open MAIN_Form based on the ID from List_Results listbox
DoCmd.OpenForm "Frm_Obligations_MULTIPLES", , , "[Oblig_ID] = " &
Me.List_Results, , acDialog
DoCmd.Close acForm, Me.Name
End Sub

'Constant Select statement for the Row Source
StrSQL = "SELECT Tbl_MAIN.Record_ID, Subtbl_Obligations_MAIN.Oblig_ID,
TBL_JUNCTION.Record_ID, Tbl_MAIN.[License Number] AS License,
Tbl_MAIN.Province, Tbl_MAIN.District_Location, Tbl_MAIN.Subdistrict_Location,
Tbl_MAIN.Area_Location, Tbl_MAIN.Field_Location, Tbl_MAIN.Surf_LE,
Tbl_MAIN.Surf_LSD, Tbl_MAIN.Surf_SEC, Tbl_MAIN.Surf_TWP, Tbl_MAIN.Surf_RGE,
Tbl_MAIN.Surf_MER, Tbl_MAIN.DLS_LE, Tbl_MAIN.DLS_LSD, Tbl_MAIN.DLS_SEC,
Tbl_MAIN.DLS_TWP, Tbl_MAIN.DLS_RGE, Tbl_MAIN.DLS_MER,
Subtbl_Obligations_MAIN.Oblig_Status AS Status, TBL_JUNCTION.Oblig_ID,
Subtbl_Obligations_MAIN.Govt_Agency AS Govt,
Subtbl_Obligations_MAIN.Obligation_Type AS Type" _
& " FROM Tbl_MAIN" _
& " RIGHT JOIN (Subtbl_Obligations_MAIN" _
& " LEFT JOIN TBL_JUNCTION" _
& " ON Subtbl_Obligations_MAIN.Oblig_ID = TBL_JUNCTION.Oblig_ID)" _
& " ON Tbl_MAIN.Record_ID = TBL_JUNCTION.Record_ID" _
 

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