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
|
|||
|
|||
Two message boxes
I have two message boxes that fire off when I am going to print a report to
determine what will show up on the report as far as fields. The first message box is to hide the customer price on a quote, if you answer yes it sets a checkbox on the initial form to true. The next message box is to show or hide the changes made to the quote on the report. If I say vbyes to both of the message boxes the customer pricing will not be hidden as the checkbox is getting set back to false. I am not sure why it is toggling, but it works if I answer yes to the first and no to hte second. It may just be the order in which the events are happening or the initial state of the checkbox. Code below: Case 1 If IsNull(Me.[Text147]) And IsNull(Me.[Text133]) Then rptType = "rpt_CustomerCopy" End If If IsNull(Me.[Text147]) And Not (IsNull(Me.Text133)) Then rptType = "rpt_CustomerCopyDisc" End If If Not (IsNull(Me.Text147)) And IsNull(Me.[Text133]) Then rptType = "rpt_CustomerCopyAdd" End If If Not (IsNull(Me.Text147)) And Not (IsNull(Me.[Text133])) Then rptType = "rpt_CustomerCopyBoth" End If HideCost = MsgBox("Hide Homeowner Cost?", vbYesNo, "Hide Cost") If HideCost = vbYes Then Me.Check161.Value = True End If If HideCost = vbNo Then Me.Check161.Value = False End If LResponse = MsgBox("Show Changes on Report?", vbYesNo, "Print Changes?") DoCmd.OpenReport rptType, acPreview, , "[JOB_ID]= " & Me.[JOB_ID] If LResponse = vbYes Then Reports(rptType).Report!rpt_Change.Visible = True End If DoCmd.Maximize DoCmd.RunCommand acCmdZoom100 |
#2
|
|||
|
|||
Two message boxes
Hi -
I notice two problems. First, you set the value of me.check161 based on a user response - but what do you do with it? How does the report know what check161 is? Secondly, you are trying to change the visibility of rpt_Change AFTER you produce the report, which doesn't work. You need to have the code in the report itself determine what fields to show, either by referencing the form's controls e.g. If Forms!MyForm!check161 = true then.... (the form must be open) or by passing the information to the report through the OpenArgs parameter of the docmd.openReport statement. You would probably want to put the code in the On Format event of the appropriate section of the report. HTH John Rockn wrote: I have two message boxes that fire off when I am going to print a report to determine what will show up on the report as far as fields. The first message box is to hide the customer price on a quote, if you answer yes it sets a checkbox on the initial form to true. The next message box is to show or hide the changes made to the quote on the report. If I say vbyes to both of the message boxes the customer pricing will not be hidden as the checkbox is getting set back to false. I am not sure why it is toggling, but it works if I answer yes to the first and no to hte second. It may just be the order in which the events are happening or the initial state of the checkbox. Code below: Case 1 If IsNull(Me.[Text147]) And IsNull(Me.[Text133]) Then rptType = "rpt_CustomerCopy" End If If IsNull(Me.[Text147]) And Not (IsNull(Me.Text133)) Then rptType = "rpt_CustomerCopyDisc" End If If Not (IsNull(Me.Text147)) And IsNull(Me.[Text133]) Then rptType = "rpt_CustomerCopyAdd" End If If Not (IsNull(Me.Text147)) And Not (IsNull(Me.[Text133])) Then rptType = "rpt_CustomerCopyBoth" End If HideCost = MsgBox("Hide Homeowner Cost?", vbYesNo, "Hide Cost") If HideCost = vbYes Then Me.Check161.Value = True End If If HideCost = vbNo Then Me.Check161.Value = False End If LResponse = MsgBox("Show Changes on Report?", vbYesNo, "Print Changes?") DoCmd.OpenReport rptType, acPreview, , "[JOB_ID]= " & Me.[JOB_ID] If LResponse = vbYes Then Reports(rptType).Report!rpt_Change.Visible = True End If DoCmd.Maximize DoCmd.RunCommand acCmdZoom100 -- John Goddard Ottawa, ON Canada jrgoddard at cyberus dot ca Message posted via http://www.accessmonster.com |
#3
|
|||
|
|||
Two message boxes
On the report I have an onOpen event that checks the status of the checkbox
on the previous form. Private Sub Report_Open(Cancel As Integer) If Form_frm_JobSelect.Check161.Value = True Then Me.HMCost.Visible = False Me.Label32.Visible = False Else Me.HMCost.Visible = True Me.Label32.Visible = True End If End Sub I think you are correct that it may need to go in the OnFormat event handler for the report section. I will give that a go and see what happens. "J_Goddard via AccessMonster.com" u37558@uwe wrote in message news:9f1144e6e5d04@uwe... Hi - I notice two problems. First, you set the value of me.check161 based on a user response - but what do you do with it? How does the report know what check161 is? Secondly, you are trying to change the visibility of rpt_Change AFTER you produce the report, which doesn't work. You need to have the code in the report itself determine what fields to show, either by referencing the form's controls e.g. If Forms!MyForm!check161 = true then.... (the form must be open) or by passing the information to the report through the OpenArgs parameter of the docmd.openReport statement. You would probably want to put the code in the On Format event of the appropriate section of the report. HTH John Rockn wrote: I have two message boxes that fire off when I am going to print a report to determine what will show up on the report as far as fields. The first message box is to hide the customer price on a quote, if you answer yes it sets a checkbox on the initial form to true. The next message box is to show or hide the changes made to the quote on the report. If I say vbyes to both of the message boxes the customer pricing will not be hidden as the checkbox is getting set back to false. I am not sure why it is toggling, but it works if I answer yes to the first and no to hte second. It may just be the order in which the events are happening or the initial state of the checkbox. Code below: Case 1 If IsNull(Me.[Text147]) And IsNull(Me.[Text133]) Then rptType = "rpt_CustomerCopy" End If If IsNull(Me.[Text147]) And Not (IsNull(Me.Text133)) Then rptType = "rpt_CustomerCopyDisc" End If If Not (IsNull(Me.Text147)) And IsNull(Me.[Text133]) Then rptType = "rpt_CustomerCopyAdd" End If If Not (IsNull(Me.Text147)) And Not (IsNull(Me.[Text133])) Then rptType = "rpt_CustomerCopyBoth" End If HideCost = MsgBox("Hide Homeowner Cost?", vbYesNo, "Hide Cost") If HideCost = vbYes Then Me.Check161.Value = True End If If HideCost = vbNo Then Me.Check161.Value = False End If LResponse = MsgBox("Show Changes on Report?", vbYesNo, "Print Changes?") DoCmd.OpenReport rptType, acPreview, , "[JOB_ID]= " & Me.[JOB_ID] If LResponse = vbYes Then Reports(rptType).Report!rpt_Change.Visible = True End If DoCmd.Maximize DoCmd.RunCommand acCmdZoom100 -- John Goddard Ottawa, ON Canada jrgoddard at cyberus dot ca Message posted via http://www.accessmonster.com |
Thread Tools | |
Display Modes | |
|
|