MS Access Forum / Modules / DAO / VBA / May 2008
Dynamic Title programming help
|
|
Thread rating:  |
Billiam - 22 May 2008 16:33 GMT I am trying to make a "Badge" report for instructors in our organization to properly identify their qualifications to students. There are two possible qualifications: Non-Restricted and Restricted. EVERY INSTRUCTOR is qualified for non-restricted, and some are also qualified to teach Restricted. I would like the title of the badge to reflect two possible titles: 1. Non-Restricted Instructor 2. Non-Restricted and Restricted Instructor
I assume with my VERY LIMITED knowledge, that I would base an IF Else statement based on the table (tblQualifications, Restricted is the field, saved as Yes/No in the table field Restricted inputed from a form called Instructors)
Having never done this before I am not sure how to go about it....
I think I would use a bound text box (as each instructor has different qualifications) that contained an If Else expression to provide the correct Badge Title based on the Instructors qualifications:
If ([TblQualifications].[Restricted]) = True THEN Badgetitle.Text = "Non-Restricted & Restricted Instructor" Else Badgetitle.Text = "Non-Restricted Instructor" End If
I do not know if I am using the right expression syntax, nor am I sure where to place the expression, or if I am even doing the right thing at all...any help appreciated!!! Billiam
Jeanette Cunningham - 23 May 2008 11:49 GMT Billiam, one suggestion is to create a calculated field in a query. Assuming you have a query with a field for the instructors' name and it includes the table which has the filed called Restricted.
In a new column in the Field row type this: Expr1:IIf([Restricted]=True,"Non-Restricted & Restricted Instructor" , "Non-Restricted Instructor") Switch the query to data sheet view and you should see a list of names with the restriction state in the next column.
You can use the query to create a report to print the badges.
Jeanette Cunningham -- Melbourne Victoria Australia
>I am trying to make a "Badge" report for instructors in our organization to > properly identify their qualifications to students. There are two possible [quoted text clipped - 30 lines] > help appreciated!!! > Billiam Billiam - 26 May 2008 14:42 GMT Thank you very much Jeanette, I will try this out and promise to rate it. I really appreciate your help...THANK YOU!!!
> Billiam, > one suggestion is to create a calculated field in a query. [quoted text clipped - 45 lines] > > help appreciated!!! > > Billiam Billiam - 26 May 2008 15:56 GMT Hi Jeanette,
I am having a problem with your solution, Jeanette. ALL of the instructors are evaluatiing to True for restricted even if the restricted field contains "No". Do I need an Else in the expression, or have I done something wrong? I copied what you had given me into the field so no errors I can see.
> Billiam, > one suggestion is to create a calculated field in a query. [quoted text clipped - 45 lines] > > help appreciated!!! > > Billiam Jeanette Cunningham - 27 May 2008 01:12 GMT Billiam, open the query in design view, then choose View | SQL from the menu bar. Copy all the sql and paste into a post so we can see what the problem might be.
Jeanette Cunningham -- Melbourne Victoria Australia
> Hi Jeanette, > [quoted text clipped - 59 lines] >> > help appreciated!!! >> > Billiam Billiam - 27 May 2008 14:07 GMT Hi Jeanette, Here is the SQL:
SELECT TblFSESO.[ON#], TblFSESO.FirstName, TblFSESO.LastName, TblFSESO.Restricted, TblFSESO.Bitmap, TblFSESO.CFSC, TblFSESO.Status, IIf([Restricted]=Yes,"Non-Restricted & Restricted Instructor","Non-Restricted Instructor") AS Expr1 FROM TblFSESO WHERE (((TblFSESO.Status)="Active" Or (TblFSESO.Status)="Interim"));
> Billiam, > open the query in design view, then choose View | SQL from the menu bar. [quoted text clipped - 66 lines] > >> > help appreciated!!! > >> > Billiam Billiam - 27 May 2008 14:40 GMT Also, if the Restricted field is empty, it Does return the "Non-Restricted Instructor" title. Billiam
> Billiam, > open the query in design view, then choose View | SQL from the menu bar. [quoted text clipped - 66 lines] > >> > help appreciated!!! > >> > Billiam Billiam - 27 May 2008 14:42 GMT I think I may have solved it...I put quotes around "Yes" and it is returning the correct titles now.
> Billiam, > open the query in design view, then choose View | SQL from the menu bar. [quoted text clipped - 66 lines] > >> > help appreciated!!! > >> > Billiam Jeanette Cunningham - 27 May 2008 23:18 GMT Billiam, that makes sense, for a Yes/No field, access uses True and False. If you replaced "Yes" with True (no quotes), it should still work.
Jeanette Cunningham -- Melbourne Victoria Australia
>I think I may have solved it...I put quotes around "Yes" and it is >returning [quoted text clipped - 79 lines] >> >> > help appreciated!!! >> >> > Billiam Billiam - 28 May 2008 12:50 GMT That's the odd part, Jeanette, I had True n the expression originally, but it had the same result as before; everything returned as a True statement, and therefore the title "Non-Restricted and restricted Instructor".
I tried "Yes" merely as an experiment, as I noticed if the Restricted field was empty, it was returning the Non-Restricted title in expression 1, so I assumed that the problem was with the True or Yes part of the expression... Bill
> Billiam, > that makes sense, for a Yes/No field, access uses True and False. [quoted text clipped - 85 lines] > >> >> > help appreciated!!! > >> >> > Billiam Jeanette Cunningham - 28 May 2008 22:53 GMT Billiam, that is a bit odd. Not sure why. Glad it's working now.
Jeanette Cunningham -- Melbourne Victoria Australia
> That's the odd part, Jeanette, I had True n the expression originally, but > it [quoted text clipped - 107 lines] >> >> >> > help appreciated!!! >> >> >> > Billiam Billiam - 29 May 2008 12:57 GMT Thanks for sticking with me through it, Jeanette! I really appreciate your help! Have a great week, Billiam
> Billiam, > that is a bit odd. [quoted text clipped - 114 lines] > >> >> >> > help appreciated!!! > >> >> >> > Billiam
|
|
|