Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with field value

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
This works except for the proj_id wont give me the project id number
when it has no records. The output on my form is:
"Project has no records"
It should be:
"Project 23 has no records" or whatever the project number is should
appear where 23 is located.

It doesnt seem to acknowlege the [proj_id] part. Anyone with
experience can tell me what I am doing wrong with this??


[tt]
=IIf(Count([proj_id])=0,"Project " & [proj_id] & "
has no resources.","Record " &
[Forms]![ProjResOM].[TEST2].[Form].[CurrentRecord]
& " of " & Count(*))[/tt]
 
I'm a bit confused...Count([proj_id]) is going to give you a count of how many times any type of [proj_id] shows up in the records that are grouped before wherever you have this count set...meaning if you're grouping by region and there are 5 projects in this region (projects 1, 2, 3, 23, 25) then it will return 5 as the count. Now I'm guessing that you are grouped somehow on [proj_id], but if that's the case then project id 23 will never show up since there isn't one...make sense? I may have missed the point on this completely...hope not though. Give me some more info and maybe I can help.

Kevin
 
I guess my question is how can I pull the project id number into my script?
Is there a way to pull the project id number?
 
Jack,

Kevin is right. Look at your code:

IIf(Count([proj_id])=0, ...
if count([proj_id])=0, then there are no records. there isn't a project id to report. it isn't giving you a project id becuase there aren't any.
Either you need to change your if statement, or restructure the code after it. Maybe if you posted your full code and table structure we could help more.

HTH!

-Brad
 
Yeah, the only time count([proj_id]) is going to be 0 is if the [proj_id] values are null...that's why you're getting nothing showing up in that formula. I'm thinking you want to look up all the proj id values in some other table and check and see if they are in this table...give us some more info, I'm sure we can help.

Kevin
 
Thanks to both of you.

I am using this on a subform to show me record of records (ex: Record 1 of 3).
I have it in my control source for a bound field. I subtituted the above "iif" statement where proj_id was in my control source.

I assumed the proj_id number was available in the iif statement. If not how can I grab it?? Is that possible??
 
I think you'll just need to grab the project id from the main form instead of the subform...just reference some text box on the main form that holds the project id. Hopefully that will help.

Kevin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top