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
IT System Manager
Cheyenne River Housing Authority
Wk.(605)964-4265 Ext. 130
Fax (605)964-1070
"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;
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: Art Lorenzini <dbalorenzini@yahoo.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (2) |
Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.
SPONSORED LINKS
.
__,_._,___
Tidak ada komentar:
Posting Komentar