paulrmiller2000
Technical User
I am stumped! I have a form built on this table:
tbl_Leads
pk_lonLeadID
fk_lonClientID
fk_lonLeadSourceID
fk_lonListingTypeID
fk_lonMaketingTypeID
fk_lonReferralTypeID
fk_lonAgentID
Each field is a Long integer.
The form has several combo boxes, populated by queries, that are bound to these fields.
I have cboListingType, cboMarketingType, cboReferralType, and cboAgent set to invisible, and I only want them visible based on certain matches from table tbl_LeadSource. That table has two fields, pk_lonLeadSourceID and txtDescription. 2 = Listing, 4 = Marketing, 5 = Referral. If the value returned in the cboLeadSource combo box is a 5 for a "referral," then cboReferralType then becomes visible. If the value for 4 (or "marketing") is returned, then cboMarketingType becomes visible.
Everything works fine, except for one combo box I added called cboAgent. If cboLeadSource returns a 5 for "referral," then cboReferralType becomes visible as appropriate. However, I want to drill down a bit further, so I want cboAgent (bound to fk_lonAgentID) to become visible if cboReferralType is populated with a 1 which equals an "Agent" (I'll then select the agent's name).
I cannot for the life of me make cboAgent visible on cboReferralType equaling 1 -- all I receive is a type mismatch error.
I have double-checked table structures, queries, and bound fields. I have deleted and reinserted the combo box. I even changed cboAgent to become visible on cboLeadSource meeting miscellaneous criteria, and that seems fine. It only seems to have a problem when being fed from cboReferralType. Here's my code:
I must be missing something painfully obvious! Can anyone please advise?
Thanks,
Paul
tbl_Leads
pk_lonLeadID
fk_lonClientID
fk_lonLeadSourceID
fk_lonListingTypeID
fk_lonMaketingTypeID
fk_lonReferralTypeID
fk_lonAgentID
Each field is a Long integer.
The form has several combo boxes, populated by queries, that are bound to these fields.
I have cboListingType, cboMarketingType, cboReferralType, and cboAgent set to invisible, and I only want them visible based on certain matches from table tbl_LeadSource. That table has two fields, pk_lonLeadSourceID and txtDescription. 2 = Listing, 4 = Marketing, 5 = Referral. If the value returned in the cboLeadSource combo box is a 5 for a "referral," then cboReferralType then becomes visible. If the value for 4 (or "marketing") is returned, then cboMarketingType becomes visible.
Everything works fine, except for one combo box I added called cboAgent. If cboLeadSource returns a 5 for "referral," then cboReferralType becomes visible as appropriate. However, I want to drill down a bit further, so I want cboAgent (bound to fk_lonAgentID) to become visible if cboReferralType is populated with a 1 which equals an "Agent" (I'll then select the agent's name).
I cannot for the life of me make cboAgent visible on cboReferralType equaling 1 -- all I receive is a type mismatch error.
I have double-checked table structures, queries, and bound fields. I have deleted and reinserted the combo box. I even changed cboAgent to become visible on cboLeadSource meeting miscellaneous criteria, and that seems fine. It only seems to have a problem when being fed from cboReferralType. Here's my code:
Code:
Private Sub Form_Current()
Me!cboListingType.Visible = (Me!cboLeadSource.Column(0) = 2)
Me!cboMarketingType.Visible = (Me!cboLeadSource.Column(0) = 4)
Me!cboReferralType.Visible = (Me!cboLeadSource.Column(0) = 5)
Me!cboAgent.Visible = (Me!cboReferralType.Column(0) = 1)
End Sub
Private Sub cboLeadSource_AfterUpdate()
Me!cboListingType.Visible = (Me!cboLeadSource.Column(0) = 2)
Me!cboMarketingType.Visible = (Me!cboLeadSource.Column(0) = 4)
Me!cboReferralType.Visible = (Me!cboLeadSource.Column(0) = 5)
Me!cboAgent.Visible = (Me!cboReferralType.Column(0) = 1)
End Sub
I must be missing something painfully obvious! Can anyone please advise?
Thanks,
Paul