nice catch, Liz!
Yep that what did the trick...
Forms![frmTenantListingDashboard]![sfrmTenantList].Form.RecordSource = strSql
Forms![frmTenantListingDashboard]![sfrmTenantList].Form.Requery
With Warm Regards,Arthur D. Lorenzini"Valar Dohaeris"
On Monday, July 16, 2018 12:00:12 PM CDT, Liz Ravenwood liz_ravenwood@beaerospace.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
I didn't review the entire code, but I'm always needing to add in a
Formname.subformname.form.requery
In there
Respectfully,
[RCEmailSigLogo]
Liz Ravenwood
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Monday, July 16, 2018 9:22 AM
To: dbalorenzini@yahoo.com [MS_Access_Professionals]
Subject: Re: [MS_AccessPros] Subform is not refreshing
Unless someone has a better idea. I came up with this.
If IsNull(Me.cmbChooseCommunity) Then
' If the combo is Null, use the whole table as the RecordSource.
Me.RecordSource = "q_TenantListing"
Else
strSql = "SELECT DISTINCTROW q_TenantListing.* FROM q_TenantListing " & _
"WHERE q_TenantListing.CommunityID = " & Me.cmbChooseCommunity & ";"
'Me.RecordSource = strSql
Forms![frmTenantListingDashboard]![sfrmTenantList].Form.RecordSource = strSql
Forms![frmTenantListingDashboard]![sfrmTenantList].Form.Requery
End If
It seems to work...
With Warm Regards,
Arthur D. Lorenzini
"Valar Dohaeris"
On Monday, July 16, 2018 10:05:22 AM CDT, dbalorenzini@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
I have a main form called frmTenantListingDashboard and on it I have a combo box called cmbChooseCommunity. Source for the combo box is:
SELECT tlkpCommunity.CommunityID, tlkpCommunity.CommunityName FROM tlkpCommunity UNION SELECT 0,"All" FROM tlkpCommunity ORDER BY CommunityName;
Also on this form I have a subform called sfrmTenantList which is defined as a continuous form with the following record source:
SELECT B4602200.NAME, tblUnit.UnitCode, tblUnit.BedroomCount, tblUnit.CurrentStatus, tblUnit.UnitStatus, tblUnit.ClassificationType, tblUnit.UnitHousingType, tlkpCommunity.CommunityName, B4602200.BSSI_Tenant_Lease_Status, B4602200.CUSTNMBR, B4602200.BSSI_Lease_Execution_Dat AS Move_In_Date, Trim([ADDRESS1]) & ", " & Trim([CITY]) & ", " & Trim([STATE]) & " " & Trim([Zip]) AS TenantAddress, tblUnit.UnitID, tblUnit.CommunityID
FROM ((B4602200 INNER JOIN tblUnit ON B4602200.LOCNCODE = tblUnit.UnitCode) INNER JOIN tlkpCommunity ON tblUnit.CommunityID = tlkpCommunity.CommunityID) INNER JOIN RM00101 ON B4602200.CUSTNMBR = RM00101.CUSTNMBR
WHERE (((tblUnit.CurrentStatus)="CRHA Use") AND ((tblUnit.UnitStatus)<>"Vacant") AND ((tblUnit.ClassificationType)="Rental") AND ((B4602200.BSSI_Tenant_Lease_Status)=2))
ORDER BY tblUnit.UnitCode, B4602200.BSSI_Lease_Execution_Dat, RM00101.CUSTNMBR;
Now in the AfterUpdate event of cmbChooseCommunity I have the following code:
If IsNull(Me.cmbChooseCommunity) Then
' If the combo is Null, use the whole table as the RecordSource.
Me.RecordSource = "q_TenantListing"
Else
strSql = "SELECT DISTINCTROW q_TenantListing.* FROM q_TenantListing " & _
"WHERE q_TenantListing.CommunityID = " & Me.cmbChooseCommunity & ";"
Me.RecordSource = strSql
End If
Now I debug this and ran the strSQL and the generated command does return data but it does not refresh the subform with the returned data. Any ideas?
Thank you ,
Art Lorenzini
Sioux Falls, SD
Posted by: crystal 8 <strive4peace2008@yahoo.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (5) |
Tidak ada komentar:
Posting Komentar