If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Conditionally Format A Line?
Greetings, Access Novice here.
I have Line18 formatted as Visible = "NO" in Properties, and I want to make it visible depending on the value of certain fields. Why doesn't this code work when put in the "On Format" or "On Print" events of the Detail section? If [Inventory Posting Group] = "RESALE" Then Line18.Visible = "YES" BTW, I tried "TRUE" in place of "YES", and it still didn't work. TIA. |
#2
|
|||
|
|||
Conditionally Format A Line?
Assuming [Inventory Posting Group] is bound to a control in the report, you
should be able to use: ME.Line18.Visible = (Me.[Inventory Posting Group] = "RESALE") -- Duane Hookom Microsoft Access MVP "1stAyd" wrote: Greetings, Access Novice here. I have Line18 formatted as Visible = "NO" in Properties, and I want to make it visible depending on the value of certain fields. Why doesn't this code work when put in the "On Format" or "On Print" events of the Detail section? If [Inventory Posting Group] = "RESALE" Then Line18.Visible = "YES" BTW, I tried "TRUE" in place of "YES", and it still didn't work. TIA. . |
#3
|
|||
|
|||
Conditionally Format A Line?
I tried that too, but didn't realize [Inventory Posting Group] had to be tied
to a report control. It's currently just on my source query. I'll try it tomorrow and report back. Thanks! Duane Hookom wrote: Assuming [Inventory Posting Group] is bound to a control in the report, you should be able to use: ME.Line18.Visible = (Me.[Inventory Posting Group] = "RESALE") Greetings, Access Novice here. [quoted text clipped - 7 lines] . |
#4
|
|||
|
|||
Conditionally Format A Line?
On Thu, 13 May 2010 20:28:14 GMT, 1stAyd wrote:
Greetings, Access Novice here. I have Line18 formatted as Visible = "NO" in Properties, and I want to make it visible depending on the value of certain fields. Why doesn't this code work when put in the "On Format" or "On Print" events of the Detail section? If [Inventory Posting Group] = "RESALE" Then Line18.Visible = "YES" BTW, I tried "TRUE" in place of "YES", and it still didn't work. TIA. You've turned the Yes (no quotes) into "Yes" (a string value). Anyway in VBA it should have been True (without the quotes) not Yes. Yes is not a VBA constant. True is. If [Inventory Posting Group] = "RESALE" Then Line18.Visible = True A simpler expression would be: Line18.Visible = [Inventory Posting Group] = "RESALE" -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail |
#5
|
|||
|
|||
Conditionally Format A Line?
Still no luck. I created txtIPG, with the control source as [Inventory
Posting Group], and have this in the "On Format" event of the detail section: =[Me].[Line18].[Visible]=([Me].[txtIPG]="RESALE") I'm sure the answer will be something really simple.... TIA. 1stAyd wrote: I tried that too, but didn't realize [Inventory Posting Group] had to be tied to a report control..... -- Message posted via http://www.accessmonster.com |
#6
|
|||
|
|||
Conditionally Format A Line?
Now I'm really confused. As an attempt to simplify, I put this line into "On
Format" of the "Detail" section: =[Me].[Line18].[Visible]=True but Line18 still isn't visible...... Thanks. -- Message posted via http://www.accessmonster.com |
#7
|
|||
|
|||
Conditionally Format A Line?
You must be in the code/module/vba window, not in the properties dialog.
There should not be any "=", just: Me.[Line18].[Visible]=([Me].[txtIPG]="RESALE") -- Duane Hookom Microsoft Access MVP "1stAyd via AccessMonster.com" wrote: Still no luck. I created txtIPG, with the control source as [Inventory Posting Group], and have this in the "On Format" event of the detail section: =[Me].[Line18].[Visible]=([Me].[txtIPG]="RESALE") I'm sure the answer will be something really simple.... TIA. 1stAyd wrote: I tried that too, but didn't realize [Inventory Posting Group] had to be tied to a report control..... -- Message posted via http://www.accessmonster.com . |
#8
|
|||
|
|||
Conditionally Format A Line?
Thanks, Duane, but I'll still SOL. In "On Format" of Detail it now says
"Event Procedure", and I copied exactly what you have into the code window. The code window now says: Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) Me.[Line18].[Visible] = (Me.[txtIPG] = "RESALE") End Sub I tried to print instead of previewing, and I got this message: "A custom macro in this report has failed to run, and is preventing the report from rendering". In case it makes a difference, I'm using Access 2007. Thanks. Duane Hookom wrote: You must be in the code/module/vba window, not in the properties dialog. There should not be any "=", just: Me.[Line18].[Visible]=([Me].[txtIPG]="RESALE") Still no luck. I created txtIPG, with the control source as [Inventory Posting Group], and have this in the "On Format" event of the detail section: [quoted text clipped - 5 lines] I tried that too, but didn't realize [Inventory Posting Group] had to be tied to a report control..... -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...ports/201005/1 |
#9
|
|||
|
|||
Conditionally Format A Line?
On Fri, 14 May 2010 17:41:06 GMT, 1stAyd via AccessMonster.com wrote:
Now I'm really confused. As an attempt to simplify, I put this line into "On Format" of the "Detail" section: =[Me].[Line18].[Visible]=True but Line18 still isn't visible...... Thanks. Not only do you appear to be confused but now I am as well grin See Duane Hookums latest reply. I suspect, as he does, that you are placing the code in the wrong place. Here is how to write code. Click on the Event Tab of the report's Detail Section property sheet. On the Format event line write: [Event Procedure] Click on the little button with 3 dots that appears on that line. The Format event code window will appear. The cursor will be flashing between 2 already existing lines of code. Between those 2 lines write: Line18.Visible = [Inventory Posting Group] = "RESALE" Exit the window and save the VBA code. -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail |
#10
|
|||
|
|||
Conditionally Format A Line?
Have you allow the application to run code? Are you viewing the report in
Print Preview? The code should look something like this: Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) Me.[Line18].Visible = (Me.[txtIPG] = "RESALE") End Sub To see if this code is causing the issue, try comment out the line of code like: Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) ' Me.[Line18].Visible = (Me.[txtIPG] = "RESALE") End Sub -- Duane Hookom MS Access MVP "1stAyd via AccessMonster.com" u60050@uwe wrote in message news:a8019d7249d18@uwe... Thanks, Duane, but I'll still SOL. In "On Format" of Detail it now says "Event Procedure", and I copied exactly what you have into the code window. The code window now says: Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) Me.[Line18].[Visible] = (Me.[txtIPG] = "RESALE") End Sub I tried to print instead of previewing, and I got this message: "A custom macro in this report has failed to run, and is preventing the report from rendering". In case it makes a difference, I'm using Access 2007. Thanks. Duane Hookom wrote: You must be in the code/module/vba window, not in the properties dialog. There should not be any "=", just: Me.[Line18].[Visible]=([Me].[txtIPG]="RESALE") Still no luck. I created txtIPG, with the control source as [Inventory Posting Group], and have this in the "On Format" event of the detail section: [quoted text clipped - 5 lines] I tried that too, but didn't realize [Inventory Posting Group] had to be tied to a report control..... -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...ports/201005/1 |
|
Thread Tools | |
Display Modes | |
|
|