Control printing according to list box options

I have two list box's that control the report that is going to print. Text20 
is the list box that displays the shed number, and the drop down list varies 
depending on what sheds are in the table. if a shed number is added or 
deleted, it is also added or deleted in the list drop down box.The row 
source is:
SELECT DISTINCT [98MatingRecords].[SHED #] FROM 98MatingRecords ORDER BY 
[98MatingRecords].[SHED #];

The second is Text22, this list box has the sections in it and the sections 
are controled by the shed number, some sheds have 1 section some have 6 and 
some have 3 or 4, so the drop down list will vary from 1 to 6 according to 
the shed that is selected. The row source for Text22 is:

SELECT DISTINCT [98MatingRecords].Section, [98MatingRecords].[SHED #] FROM 
98MatingRecords WHERE ((([98MatingRecords].[SHED 
#])=([Forms]![1,9,10-12DayRemates]![Text20]))) ORDER BY 
[98MatingRecords].Section;

Right now in my print button I have this code

If Option66 = True Then

    stDocName = "1,9,10-12DayRemates,Scratches"
    DoCmd.OpenReport stDocName, acNormal
    Text22 = Text22 + 1
  If (Text22 >= (Forms![ProgramSetUp]![Text20] + 1)) Then
     Text22 = 1
     Text20.SetFocus
     Text20 = Text20 + 1
  End If

 Else

    stDocName = "1,9,10-12DayRemates"
    DoCmd.OpenReport stDocName, acNormal
    Text22 = Text22 + 1
  If (Text22 >= (Forms![ProgramSetUp]![Text20] + 1)) Then
     Text22 = 1
     Text20.SetFocus
     Text20 = Text20 + 1
  End If
 End If

What is suppose to happen is!
text20 is shed 9, shed 9 only has 1 section, so only 1 is in the list, we 
pick it, we click print and it prints. As soon as it finnishes sending the 
print job, it is to set text20 to the next shed which is 10, because there 
is only 1 section in 9, But in shed 10 there are 4 sections, so it should 
set text20 to 10 and text22 to 1 for the first section. after the job is 
sent, it should set text22 to2, and so on till section 4 is reached, then 
advance text20 to 11 for shed 11 and text22 to 1 for the 1st section. But 
shed 11 only has 3 sections so after the 3rd section it should advance 
Text22 to shed 51 because that is the next shed in the list for text20 and 
text22 to 1 for the first section of that shed. shed 51 has 6 section so it 
should advance text22 through the 6 sections then go to the next shed in the 
list box, and so on and so on.

Can some one help me change this code to do this?

This line was used before the text box's were updated with the row source to 
control the shed and sections
  If (Text22 >= (Forms![ProgramSetUp]![Text20] + 1)) Then

It is now no longer needed but I don't know what to replace it with to 
accomadate the new text box's row source

Thanks Blair 


0
SBGFF
3/3/2007 9:07:55 PM
access.formscoding 7494 articles. 0 followers. Follow

2 Replies
694 Views

Similar Articles

[PageSpeed] 17

SBGFF,

It sounds as if what you are actually doing is from the selected starting 
point of the selected shed, you want to print a report for each Section in 
that shed and repeat the process for the remaining sheds, running the report 
for each section of each shed.

If this is an accurate statement, then it might be simpler to modify your 
report to to have it produce the report for all of the sections in each shed, 
starting from the selected shed.  You would simply need a sub report and have 
the data deliver to the report the data for all remaing sheds and all 
sections of those sheds. Then group your report by shed and have it produce a 
new page for each section.

This way you would not have to worry abuot incrementing the values in text 
boxes, but rather let the report do the work.

This was simply my observation. If this is not what you are trying to do, 
please post back with more information.

-- 
HTH

Mr B


"SBGFF" wrote:

> I have two list box's that control the report that is going to print. Text20 
> is the list box that displays the shed number, and the drop down list varies 
> depending on what sheds are in the table. if a shed number is added or 
> deleted, it is also added or deleted in the list drop down box.The row 
> source is:
> SELECT DISTINCT [98MatingRecords].[SHED #] FROM 98MatingRecords ORDER BY 
> [98MatingRecords].[SHED #];
> 
> The second is Text22, this list box has the sections in it and the sections 
> are controled by the shed number, some sheds have 1 section some have 6 and 
> some have 3 or 4, so the drop down list will vary from 1 to 6 according to 
> the shed that is selected. The row source for Text22 is:
> 
> SELECT DISTINCT [98MatingRecords].Section, [98MatingRecords].[SHED #] FROM 
> 98MatingRecords WHERE ((([98MatingRecords].[SHED 
> #])=([Forms]![1,9,10-12DayRemates]![Text20]))) ORDER BY 
> [98MatingRecords].Section;
> 
> Right now in my print button I have this code
> 
> If Option66 = True Then
> 
>     stDocName = "1,9,10-12DayRemates,Scratches"
>     DoCmd.OpenReport stDocName, acNormal
>     Text22 = Text22 + 1
>   If (Text22 >= (Forms![ProgramSetUp]![Text20] + 1)) Then
>      Text22 = 1
>      Text20.SetFocus
>      Text20 = Text20 + 1
>   End If
> 
>  Else
> 
>     stDocName = "1,9,10-12DayRemates"
>     DoCmd.OpenReport stDocName, acNormal
>     Text22 = Text22 + 1
>   If (Text22 >= (Forms![ProgramSetUp]![Text20] + 1)) Then
>      Text22 = 1
>      Text20.SetFocus
>      Text20 = Text20 + 1
>   End If
>  End If
> 
> What is suppose to happen is!
> text20 is shed 9, shed 9 only has 1 section, so only 1 is in the list, we 
> pick it, we click print and it prints. As soon as it finnishes sending the 
> print job, it is to set text20 to the next shed which is 10, because there 
> is only 1 section in 9, But in shed 10 there are 4 sections, so it should 
> set text20 to 10 and text22 to 1 for the first section. after the job is 
> sent, it should set text22 to2, and so on till section 4 is reached, then 
> advance text20 to 11 for shed 11 and text22 to 1 for the 1st section. But 
> shed 11 only has 3 sections so after the 3rd section it should advance 
> Text22 to shed 51 because that is the next shed in the list for text20 and 
> text22 to 1 for the first section of that shed. shed 51 has 6 section so it 
> should advance text22 through the 6 sections then go to the next shed in the 
> list box, and so on and so on.
> 
> Can some one help me change this code to do this?
> 
> This line was used before the text box's were updated with the row source to 
> control the shed and sections
>   If (Text22 >= (Forms![ProgramSetUp]![Text20] + 1)) Then
> 
> It is now no longer needed but I don't know what to replace it with to 
> accomadate the new text box's row source
> 
> Thanks Blair 
> 
> 
> 
0
Utf
3/4/2007 11:58:03 PM
If I understand you correctly, you are right, But I am not sure I understand 
how your report would work. My report  has 6 subreports in it now, for 
different conditions that arise each day

What I really want the control button to do is each time I click it, it will 
print the report, then automatically select the next section in that shed. 
when it has gone through all the sections of that shed , advance to the next 
shed and do it allover again till all the sheds have been gone through.
Right now I have to manually select each shed and section, I would like to 
automate it.
Thanks for any help you can give
Blair

"Mr B" <MrB@discussions.microsoft.com> wrote in message 
news:17CAB7C0-0618-459B-AF8B-40094058FD0B@microsoft.com...
> SBGFF,
>
> It sounds as if what you are actually doing is from the selected starting
> point of the selected shed, you want to print a report for each Section in
> that shed and repeat the process for the remaining sheds, running the 
> report
> for each section of each shed.
>
> If this is an accurate statement, then it might be simpler to modify your
> report to to have it produce the report for all of the sections in each 
> shed,
> starting from the selected shed.  You would simply need a sub report and 
> have
> the data deliver to the report the data for all remaing sheds and all
> sections of those sheds. Then group your report by shed and have it 
> produce a
> new page for each section.
>
> This way you would not have to worry abuot incrementing the values in text
> boxes, but rather let the report do the work.
>
> This was simply my observation. If this is not what you are trying to do,
> please post back with more information.
>
> -- 
> HTH
>
> Mr B
>
>
> "SBGFF" wrote:
>
>> I have two list box's that control the report that is going to print. 
>> Text20
>> is the list box that displays the shed number, and the drop down list 
>> varies
>> depending on what sheds are in the table. if a shed number is added or
>> deleted, it is also added or deleted in the list drop down box.The row
>> source is:
>> SELECT DISTINCT [98MatingRecords].[SHED #] FROM 98MatingRecords ORDER BY
>> [98MatingRecords].[SHED #];
>>
>> The second is Text22, this list box has the sections in it and the 
>> sections
>> are controled by the shed number, some sheds have 1 section some have 6 
>> and
>> some have 3 or 4, so the drop down list will vary from 1 to 6 according 
>> to
>> the shed that is selected. The row source for Text22 is:
>>
>> SELECT DISTINCT [98MatingRecords].Section, [98MatingRecords].[SHED #] 
>> FROM
>> 98MatingRecords WHERE ((([98MatingRecords].[SHED
>> #])=([Forms]![1,9,10-12DayRemates]![Text20]))) ORDER BY
>> [98MatingRecords].Section;
>>
>> Right now in my print button I have this code
>>
>> If Option66 = True Then
>>
>>     stDocName = "1,9,10-12DayRemates,Scratches"
>>     DoCmd.OpenReport stDocName, acNormal
>>     Text22 = Text22 + 1
>>   If (Text22 >= (Forms![ProgramSetUp]![Text20] + 1)) Then
>>      Text22 = 1
>>      Text20.SetFocus
>>      Text20 = Text20 + 1
>>   End If
>>
>>  Else
>>
>>     stDocName = "1,9,10-12DayRemates"
>>     DoCmd.OpenReport stDocName, acNormal
>>     Text22 = Text22 + 1
>>   If (Text22 >= (Forms![ProgramSetUp]![Text20] + 1)) Then
>>      Text22 = 1
>>      Text20.SetFocus
>>      Text20 = Text20 + 1
>>   End If
>>  End If
>>
>> What is suppose to happen is!
>> text20 is shed 9, shed 9 only has 1 section, so only 1 is in the list, we
>> pick it, we click print and it prints. As soon as it finnishes sending 
>> the
>> print job, it is to set text20 to the next shed which is 10, because 
>> there
>> is only 1 section in 9, But in shed 10 there are 4 sections, so it should
>> set text20 to 10 and text22 to 1 for the first section. after the job is
>> sent, it should set text22 to2, and so on till section 4 is reached, then
>> advance text20 to 11 for shed 11 and text22 to 1 for the 1st section. But
>> shed 11 only has 3 sections so after the 3rd section it should advance
>> Text22 to shed 51 because that is the next shed in the list for text20 
>> and
>> text22 to 1 for the first section of that shed. shed 51 has 6 section so 
>> it
>> should advance text22 through the 6 sections then go to the next shed in 
>> the
>> list box, and so on and so on.
>>
>> Can some one help me change this code to do this?
>>
>> This line was used before the text box's were updated with the row source 
>> to
>> control the shed and sections
>>   If (Text22 >= (Forms![ProgramSetUp]![Text20] + 1)) Then
>>
>> It is now no longer needed but I don't know what to replace it with to
>> accomadate the new text box's row source
>>
>> Thanks Blair
>>
>>
>> 


0
SBGFF
3/5/2007 7:57:33 AM
Reply:

Similar Artilces:

create drop down for address list
I want to create an invoice with a drop down list for the "Bill To" section. Any help would be apreciated Much help, Marlis. Try this: http://www.officearticles.com/tutorials/order_form_or_invoice_form_in_microsoft_excel.htm And in particular, there's a link (on that same page) to a complete invoicing system you might like even better. ******************* ~Anne Troy www.OfficeArticles.com "Marlis" <Marlis@discussions.microsoft.com> wrote in message news:3792457B-D0CD-4329-BB69-ED89A49C0C45@microsoft.com... > I want to create an invoice with a drop down li...

bound control or inbound control
Hi Katherine, There are differences between using bound versus unbound controls. Where on the form do you want to use an unbound control? Jeanette Cunningham "Katherine" <Katherine@discussions.microsoft.com> wrote in message news:23BBC192-0A74-4B9F-9513-5E5923A76658@microsoft.com... > ...

why won't word 2007 release control of a .rtf file after exiting w
I AM HAVING TROUBLE WITH ACCESS TO RICH TEXT FILES BY PROGRAMS OTHER THAN WORD------ AFTER THE FILE OPEN IN WORD IS CLOSED AND EVEN AFTER WORD HAS BEEN SHUT DOWN (EXITED) ---------- I GET THE ERROR MESSAGE THAT THE FILE IS "IN USE" BY WORD WHEN (FOR EXAMPLE) AN ATTEMPT IS MADE TO DELETE IT ---- SOMETIMES WHEN RE-OPENING THE FILE AFTER RE-STARTING WORD THE FILE CANNOT BE SAVED BECAUSE IT IS IN "READ ONLY" MODE ------- AFTER MUCH FIDDLING AROUND I FINALLY MANAGED TO DELETE THE PROBLEM FILE ONLY TO HAVE THE SAME PROBLEM RETURN WITH A DIFFERNT FILE ----- WORD 200...

Paste as Text option is missing...help
I am using Excel 2000 (9.0.6926 SP-3) and I can't find the "Paste as Text" option to save my life. It's been a while since I have tried to use the option, but it should be under "paste special" correct? Anyone? Look under PasteSpecial and click the Value option. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "ron" <ron_mase@yahoo.com> wrote in message news:49ff3227.0407210724.12756611@posting.google.com... > I am using Excel 2000 (9.0.6926 SP-3) and I ca...

RE: Control
Can some one point me right direction to achive this following. Need to dispaly a data in a table format. some of the column data may have to display a image/icon based on a value from the table (1 :- Red color icon, 2:-yellow color icon...) Once the data is loaded and displayed on the format , able to search particular row by column index and update the values including the images(change different image). I tried with Listview control, with the report view I am not able to search row and update the columns with the List vew I am not able to show the image/icon. do not want to use ...

Previewing and printing column headings for multiple pages in Excel
This is a multi-part message in MIME format. ------=_NextPart_000_0012_01C68FA0.94B99F10 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To preview and print multiple pages with column headings on each page = the procedure is as follows; a.. click 'File' then select 'Page Setup...' b.. select 'Sheet' tab c.. place cursor in 'Rows to repeat at top:' field d.. and simply position cursor above the dialogue window until the = cursor changes to a right pointing arrow and click once on the first row = or ...

MSCRM login and the Users Control Panel
Is anyone aware of any way that the settings stored under Control Panel - Users - Password Management might interfere with the process of Single Sign On into MSCRM? It seemed to have somehow cached someones login and prevented logging in as the logged in user, until cached credentials had been "deleted". However I have never seen this mentioned as being relevant. I am not too sure what the architecture model is there, but it appears to be a single domain. If this area has any relevance, it would be useful to know....thanks ...

Associate an activity to each record of a marketing list
Hi all, If Im not wrong, when distibuting a campaign activity, that activity is assigned to people (record owers or myself). However, I would like the activity to be displayed in the activities of each record of the marketing list. How to do that? Thank you! ...

Money 2004 crashes when requesting "account list"
I've been using Money for quite a while, and built a large file. I upgraded to 2004 when buying a new computer and imported the old file. When I request "Account List" from the button or the "Accounts & Bills" menu, the program declares an error and closes itself. The error message it transmit to Microsoft is "AppName: msmoney.exe AppVer: 12.0.0.613 ModName: mspfctl0.dll ModVer: 12.0.0.613 Offset: 0002f2a5" Another Money file I have (tracking a different set of accounts) does not have this problem. I have tried remove and reinstalling the progr...

Adding a control variable
Hello all, Under VC++ 7.1, I've added a checkbox to a dialog. Using the dialog editor, I am not trying to add a control variable for this check box. However, when I right-click on the check box and select "Add Variable", the resulting wizard dialog does not allow me to select "Control Variable" (it is grayed out). What do I need to do to get a control variable for this check box added to my class? Thanks, Dave I've never seen that before - are you able to duplicate this problem with other projects too? -- Regards, Nish [VC++ MVP] "Dave" <bett...

Spam control - MS Outlook
Hi! I am using MS Outlook 2000 and use 2 profiles. I recently installed a firewall package (Fsecure = Telia S�ker Surf), including Spam control. After install, MSO hangs and I cannot change to the other profile (if I not removed MSO by ctrl/alt/del) Somebody want to comment this? /Sven-Erik Intergrated AV/Spam is the cause of frequent issues in Outlook Is the FSecure you installed compatible with this old version of Outlook? "Storfille" <storfille@ebrev.net> wrote in message news:b1Ixm.11987$U5.164765@newsb.telia.net... > Hi! > > I am using MS Outlook 200...

Releasing memory after creating OCX control
Hi, I try to create an instance of an activex control in my MFC dialog based app. Though my application works with out any error, if i check the memory after calling "delete pMyControl" it keeps on occupying the same memory it occupied when the control was alive. Could anyone help me where I am missing to clear the memory? Thank you. My Code here ---------------m_pxWmp= new CWMPPlayer4();if( m_pxWmp->Create("replay", WS_CHILD | WS_BORDER | WS_VISIBLE , CRect(100, 100,320,240), this, 2)){ m_replay = true; m_pxWmp->SetUrl("C:\\video.avi"); m_pxWmp->Set...

Cannot print
I have XP Pro with Picture It Publisher 2001. My printer is an HP7850. When I attempt to print a project, I receive the MS message "program has encountered a problem and needs to close" There appears to be no issue with the printer, but I have yet to be able to print any project. Can anyone lend a suggestion? Thank You --- -- Jawone48 Picture It is not Publisher. Two completely separate programs. -- JoAnn Paules Microsoft MVP - Publisher How to ask a question http://support.microsoft.com/kb/555375 "jawone48" <jawone48@discussions.microsoft.com> wrote in ...

Numbered List
New user of Outlook 2007 and recently created an email that had a numbered list that was quite long. It went to 17 items, and was left aligned. Is there anyway to change that to right aligned, short of using Word as the email editor. Thanks Carl well, you are using word as the editor in 2007.... Did you try selecting one of the items (or all) then clicking the little down arrow on the number list button and making a new numbered format? -- Diane Poremsky [MVP - Outlook] Need Help with Common Tasks? http://www.outlook-tips.net/beginner/ Outlook 2007: http://www.slipstick.com/outlook/ol2...

Creating dialog controls at run-time
I've been researching how to do this, but whenever I try what other people do, I get very bad results. But my challenge doesn't end there. The number of controls I want to create is only known at run-time. The problems I face are manifold: 1. The code most people use fails badly. Not only is the font unconventionally big, but when I click the checkbox I create, the whole dialog disappears. If that's not enough, the pointer to the control is NULL when the dialog's destructor is called, so I can't delete the instance, and get a memory leak message when the program ends: CADi...

Printing jpg file???
Hi all, with a non-Doc/View mfc project I have to print a jpg file. It is going to be so simple. When I cl�ck a button, the application will open a pre-defined jpg file and it will send it to default printer? I need help and sample code about this issue??? Help please... Thanks in advance Brav "BravoX" <puero@kornelya.com> wrote in message news:%23FxzyzlPFHA.1268@TK2MSFTNGP14.phx.gbl... > Hi all, > with a non-Doc/View mfc project I have to print a jpg file. > It is going to be so simple. When I cl�ck a button, the application will > open a pre-defined jpg...

Exchange 2003 mail boxes
hi all, am encountering the following problem: In outlook (any version) when I open the address book and select any name then the properties then under "general" press "contacts" (or "personal address book" in the previous versions") and then select "activities" tab, it displays the e-mails of that name. I do not know how it is happening but it is there. Please help. Regards. Sounds like you have the Journalling feature of Outlook enabled. -- Mark Fugatt Exchange MVP http://www.exchangetrainer.com http://www.msexchange.org "Nazih Da...

what control can display characters from txt files in a dialog?
I want to read lines from txt files and display them on a dialog.I wonder which control can be put into the dialog to hold the characters from txt? Something like :- while(m_file.ReadString(tmpstr)) { str += tmpstr; } m_edit.SetWindowText(str); -- Regards, Nish [VC++ MVP] "liao_xf" <sclxf@sina.com> wrote in message news:001401c3652f$177b9830$a001280a@phx.gbl... > Thanks first! > I know that Edit control can receive and edit input. > and I know the filestdio can read lines from txt. > but can you tell me how to attatch the lines to the edit? > Thanks!...

stock control system
trying to see up a 'basic stock control sytem' for a warehouse that contains building materials. -- Thank you. You can use multiple ways of doing, there's 3 ways to come to m head... 1) Use a worksheet as database an save all the information on the cell of that worksheet using some macros to access it and handle. 2) You might want to use Access instead of Excel, I think would b easier to handle the database portion and you still have the Macro available. 3) You can use VB with an Access to create an application -- fanay ------------------------------------------------------...

MDI support in ATL composite control
Hi, I have components created in ATL. The components are ATL composite controls. Entire work has been done till now using ATL, however I now need to give MDI type of work area (based o doc-view architecture) within the control. I have class derived from CMDIFrameWnd. However when I try to initialize instance of this class by calling "Create" method of CFrameWnd (base class in CMDIFrameWnd), I get error and creation fails. Tracing the code, I found that base class create method calls "AfxGetInstanceHandle" to get handle to the DLL. Now since this is ATL Composite control, ...

Device Manager Get list all the hardware devices installed in a computer?
Dear All, Windows XP Pro SP2 Outlook Express 6.X Access 2002 Pro / Access 2003 Pro I want to get a list of all the hardware devices installed in a computer (Start-Settings-Control Panel-System-Hardware Tab - Device Manager) Devices by type, by connection, resources by type, resources by connection and the hidden devices Also of each device get: The Driver Provider The Driver Date The Driver Version The digital Signature And the Driver File Details (Its paths) Is there any API? Is this possible? Now if there is an app. that I can download freeware/payware that exports all this information...

Printing large-format output from Publisher
All, This may not be the "proper" forum for this question, but I'm hoping someone here may have an answer for me. I have a Publisher document (finished size about 11 x 25) that I print using an HP deskjet printer, to both sides of 100 lb. weight glossy paper, 13"w x 26"l; I then trim the sides, top & bottom edges, and fold the completed document into a two-sided three-fold brochure. So far so good. The current printer is OK, but it's slooow and the pages take quite a while to dry before I can print the second side. I've already adjusted ink density...

View Filtering and Access Controls for Business Units
I am trying to implement MS-CRM for my company. We have multiple Business Units . I need to give views to each Business Units so that they see only their own Contacts/Accounts/Opp lists. How do I accomplish this ? Also, If I gave inter business unit acesses , how do I make sure that the one business unit users can not modify any fields on other's Business Unit's records ? Thanks in advance for any help, Kishore This is quite easy to do with CRM. Assuming you have already created your Business Units in CRM, you can view a security role within one of the Business Units and a...

Synchronize combo boxes
I am trying to sync to combo boxes on a form. It is for plant names which consist of Genus + Species + Subspecies, basically. I have all my data in a single table and I want only applicable species to show up for a particular Genus, for example: Abies concolor Abies glauca Abies alba Quercus alba Quercus macrocarpa Any genus can have many species, some of those species names can exist within multiple Genus names, I have made to seperate tables with just Genus and just Species names, I want them to link in the combo boxes, any ideas? Previously responded to... Regards ...

X Report Printing
Here's my problem... I am unable to print a X, Z or ZZ report from my office printer. It will print to the receipt printer but I would like to be able to print it from the office on 8.5 x 11 paper. Does anyone have a template for this or know how I could go about setting this up so it will work. Any help would be most appreciated. Thanks! In SO Manager, Database/Registers/Receipt Formats, create a new format - call it something like "Full Page". Under "Receipt and Report templates", the last entry is labeled "Report" - click the magnifying glass to ...