Ray & Micron ~ Can't thank you guys enough
I have shifted gears here due to there were more issues awaiting me once this issue was solved...
I recreated the form to incorporate a subform, relinked all the textboxes and got the subform to populate perfectly using the combobox selection.
But, when I added the query for the main form, I received back a RT Error 3022 -
"The changes you requested to the table were not successful because they would create duplicate values in the index...blah, blah, blah."
So now my question is, how do I convince my form that I just want to view a record - not add a record??
As for the code, I'll post both queries and then what I have in the AfterUpdate event of the Combobox
Here is the query for the main form
Code:
SELECT tblData.Reipient, tblData.ReipientFaxNum, tblData.RequestDt, tblData.RequestPriority, tblData.DMIS, tblData.FacilityName, tblData.R_ProviderNm, tblData.R_ProviderNPI, tblData.RefNum, tblData.UIN, tblData.SponsorSSN, tblData.PatientID, tblData.PatientNm, tblData.PatientDOB, tblData.PatientGender, tblData.PatientAddress, tblData.PatientCity, tblData.PatientState, tblData.PatientZip, tblData.PatientPhone, tblData.EnrolledDMIS, tblData.EnrolledFacility, tblData.EnrolledRegion, tblData.SHCP, tblData.PrimaryProvisionalDiagnosis, tblData.ReasonForRequest, tblData.HealthNetReviewerNm, tblData.S_ProviderSpecialty, tblData.S_ProviderNm, tblData.S_ProviderPhone, tblData.S_ProviderNPI, tblData.S_GroupNm, tblData.S_GroupAddress, tblData.S_GroupCity, tblData.S_GroupState, tblData.S_GroupZip, tblData.S_GroupNPI, tblData.S_FacilityName, tblData.S_FacilitySpecialty, tblData.S_FacilityAddress, tblData.S_FacilityCity, tblData.S_FacilityState, tblData.S_FacilityZip, tblData.S_FacilityNPI
FROM tblData
WHERE (((tblData.RefNum)=[Forms].[FrmOverSeas].[CmboRef].[Text]));
Here is the query for the subform
Code:
SELECT tblServiceLines.RefNum, tblServiceLines.ServiceDecision, tblServiceLines.ServiceType, tblServiceLines.PlaceOfService, tblServiceLines.ServiceCodeRange1, tblServiceLines.ServiceCodeRange2, tblServiceLines.ServiceQty, tblServiceLines.AuthorizedStartDate, tblServiceLines.AuthorizedEndDate, tblServiceLines.ServiceDescription
FROM tblServiceLines RIGHT JOIN tblData ON tblServiceLines.RefNum = tblData.RefNum
WHERE (((tblServiceLines.RefNum)=[Forms].[FrmOverSeas].[CmboRef].[Text]));
And finally here is the code stored in the AfterUpdate Event of the ComboBox
Code:
Private Sub CmboRef_AfterUpdate()
Dim Frm1 As Form
Set Frm1 = Forms("FrmOverSeas")
'FrmOverSeas.Requery
Frm1.Requery
tblServiceLines.Requery
End Sub
A couple additional notes - TblServiceLines in the above query is actually the SubForm. For whatever reason the SubForm adopted the table name and any attempt to change it (at least by me) to FrmServiceLines renders the form useless
Also, for some reason I had to Dim the main form requery but the SubForm requery (TblServiceLines.Requery) works perfectly with setting it as a variable
For all intents and purposes, I am brand new to subforms (can you tell?)
Anyway, the code errors @ Frm1.Requery, but commenting all of the main form code and the subform displays all the service lines associated with the Ref# perfectly.
Sorry for the book - Thanks in advance for any help... I feel as though I'm close -