puppygirl3939
Technical User
Please help!
I have two subforms in one main form. Subform 1 called county and subform 2 called region. The region form is populated by what county the user selects in the county subform. The code below is working fine by adding the region to the region table but I have to exit the form and then enter again in order to see the region on the subform. The code that I am using is
Private Sub Counties_Click()
Dim strCounty As String
Dim strRegion As String
Dim dbsFUD As Database
Dim recPartners As DAO.Recordset
Dim frmRegion As DAO.Recordset
Set dbsFUD = CurrentDb
Set recPartners = dbsFUD.OpenRecordset("Ref_Main_Regionals"
Set frmRegion = dbsFUD.OpenRecordset("RefMainRegionalsQuery"
strRegion = recPartners("RegionalPartners"
If strCounty = "Orange" Then
strRegion = "Progress Energy"
End If
'Update Tables and Forms
recPartners.AddNew
recPartners("Referral ID Number" = Forms![frmRefMain]!txtRefID
recPartners("RegionalPartners" = strRegion
recPartners.Update
frmRegion.Requery
End Sub
I have two subforms in one main form. Subform 1 called county and subform 2 called region. The region form is populated by what county the user selects in the county subform. The code below is working fine by adding the region to the region table but I have to exit the form and then enter again in order to see the region on the subform. The code that I am using is
Private Sub Counties_Click()
Dim strCounty As String
Dim strRegion As String
Dim dbsFUD As Database
Dim recPartners As DAO.Recordset
Dim frmRegion As DAO.Recordset
Set dbsFUD = CurrentDb
Set recPartners = dbsFUD.OpenRecordset("Ref_Main_Regionals"
Set frmRegion = dbsFUD.OpenRecordset("RefMainRegionalsQuery"
strRegion = recPartners("RegionalPartners"
If strCounty = "Orange" Then
strRegion = "Progress Energy"
End If
'Update Tables and Forms
recPartners.AddNew
recPartners("Referral ID Number" = Forms![frmRefMain]!txtRefID
recPartners("RegionalPartners" = strRegion
recPartners.Update
frmRegion.Requery
End Sub