Link to home
Start Free TrialLog in
Avatar of Scotto123
Scotto123

asked on

Count Related Records in other Table and if >1 change control

I want to populate a control (not bound) on my continuous form when there are records in a different table.  

I've gotten this far but need help making the control change.  
DLookup("Count(*)", "[BoardComments]", "[BoardID] = " & Me.BoardID)

Something like this?
If
DLookup("Count(*)", "[BoardComments]", "[BoardID] = " & Me.BoardID)>0
Then
me.CommentsYes=1
Else
me.CommentsYes=0
End If

Doesn't like that.  Suggestions?
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

If you use an unbound control, every record will show the same value as derived from the current record.  You cannot show different values in different records.
Avatar of Scotto123
Scotto123

ASKER

That's why I'm using the Dlookup to lookup the BoardID from the current record.  
Still won't work?
I see your point Peter.  So if I bound the control to the table, how would the code look?
ASKER CERTIFIED SOLUTION
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Examine Pete's suggestion first.

For strictly informational purposes, here is something similar I did for another similar question
(If a Customer had Orders)
Database34.mdb
I will work on this when I get back to work on 9/3.  I will take both solutions into consideration.  Thank you.