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 7493 articles. 0 followers. Follow

2 Replies
1245 Views

Similar Articles

[PageSpeed] 51

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:

Great Plains 8.0 on a Domain Controller
Has anyone ever experienced any problems installing Great Plains 8.0 Standard on a Windows 2003 Server Domain Controller? The site has a very low number of users (8) and they want to do this. Any issues with GP support after the fact? Thanks, Kevin Cristiano Nope.... I have a GP MSSQL system running on SBS 2003, which is a domain controller, with exchange, isa and other things. Just make sure you have enough hardware and resources MLF "KJC" wrote: > Has anyone ever experienced any problems installing Great Plains 8.0 > Standard on a Windows 2003 Server Domain Cont...

How can I get To-do's to show up in the Today screen Task list?
Hi, I am a new Outlook user, and have recently run into a problem in that I missed doing some things I had made "To-Do" to remind me to do. Unfortunately, I assumed that the Today screen would show my active "To-Do's" but I realize it only show's "Tasks". I'm a unclear what the difference is. Is there anyway to integrate them so they both show up on the Today screen? Why are they in different folders? Thanks for your help. Ed Outlook 2007? They are on the To-do Bar... it's replacing Outlook today because few users use it. The to-do list ...

using one combo box to determine content of a second combo box
Hello, I have been trying for several days to figure out how to use one combo box to determine the content of a second combo box. I am creating a database listing equipment by manufacturer and model # I would like to create one combo box that gives a drop down list of manufacturers Then, based on the manufacturer chosen, I would like to have a second combo box which gives a drop down list of model #'s offered by the chosen manufacturer It seems like a fairly simple concept, but I have poured through the "using access 2003" guide with no luck Access version I'm using: 20...

Combo Box Search Time
Hello Group, I have a combo box that I currently use with the Auto Expand feature on. This combo box points to a field in a query with 400,000 records. The box works fine but has about a 30 second latency delay from the time it gets focus to the time where it will display the records. I would like to cut this latency down to as little as possible. As a side note, I have 2 forms each with a combo box pointing to 2 different queries each with 400K records. The first combo box is a zip code lookup and works super fast; the moment you click it the results pop right up. The second combo box ...

office prints only a half of 1st page
When I print anything in Office (excell, words..) it prints a half of first page only. help plese Use print preview to see if you have messed up your top and bottom margins or space for headers and footers. If you see nothing there try selecting all cells and clearing your manual page breaks. Insert, Reset/remove all page breaks Also check File, Print Area- --- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm "leokon&q...

Using CIPAddressCtrl in stead of an edit control
If I use a CIPAddressCtrl on my property page it does a great job of handling the 4 bytes with periods but how do I get the address in and out of the property page in the DataExchange function? Do I have to handle the DWORD as the exchange data? Rob DDX_Text should work... "Rob K" <rbk@no.spamm.net> д���ʼ� news:3zgsf.10739$SM6.8164@fe15.lga... > If I use a CIPAddressCtrl on my property page it does a great job of > handling the 4 bytes with periods but how do I get the address in and out of > the property page in the DataExchange function? Do I have to handle th...

auto fillin box for e-mail show deleted addresses ... how do I get rid of them?
I go to create a new e-mail (with Outlook 2007) and fill in the 'To' field with one alpha character. I see a drop down box (to speed things along) but at least one of those 'suggestions' is not valid; that particular address does not exist. It did exist at one time though. How do I flush out those helpful though inaccurate\old e-mail addresses? Thanks, DH either select it using the arrow key and press delete or delete the nk2 cache file. http://www.outlook-tips.net/archives/2006/20060823.htm -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24...

Filter List for Linked Values
I have a list of Numbers. In that list some Cells are: - Linked Values [ e.g. ='[Sales.xls]Sheet1'!K61) ] - Forumlas [ e.g. =1802+254+356 or =sum(A2:B32) ] - Manually Entered I want to filter the list for linked values. Is this possible? Hi not without VBA (using a user defined function) and a helper column >-----Original Message----- >I have a list of Numbers. In that list some Cells are: > > - Linked Values [ e.g. ='[Sales.xls]Sheet1'!K61) ] > - Forumlas [ e.g. =1802+254+356 or =sum(A2:B32) ] > - Manually Entered > > I want to filter the l...

Printing Formatted Cells
I have conditional format on a cell to format with say Fill Red ... It displays OK on the screen but doesn't appear when printed? I'm sure it'll be something obvious! Is your print setting for color, or B&W? Long shot, but I'm not sure of any other reason why what-you-see is not what-you-get. -- Best Regards, Luke M "Charlie" <Charlie@discussions.microsoft.com> wrote in message news:C94E101A-9579-4FDB-8AEF-91D59E1EC3A4@microsoft.com... >I have conditional format on a cell to format with say Fill Red ... It > displays OK on the sc...

how do you print oversized to "Scale to fit"?
How do you print an oversized piece to scale down on normal paper? I cant find a "scale to fit" type option anywhere in the print dialog. I would convert it to .pdf and print that to fit. -- JoAnn Paules MVP Microsoft [Publisher] Tech Editor for "Microsoft Publisher 2007 For Dummies" "Greg" <Greg@discussions.microsoft.com> wrote in message news:522EDEFF-50A7-4045-9434-E3F638CD35A3@microsoft.com... > How do you print an oversized piece to scale down on normal paper? I cant > find a "scale to fit" type option anywhere in the print dia...

Printing address lables from spreadsheet?
I have created numerous address lists on spreadsheets. Is it possible to construct these lists in a way to send to a printer and it just labels the envelopes and such? I do this all the time... I use mail merge in Word and use my exce sheet as the database. I have found it to be the best way to get whole bunch of different envelopes/letters out quickly -- eluehman ----------------------------------------------------------------------- eluehmann's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1309 View this thread: http://www.excelforum.com/showthread.php?th...

For Roady Re Post Of Information Box at Startup
Hi Roady Your message was unavailable could you reply again to Oringinal Message On some computers running NT4 and Exchange 5.5 with XP pro Clients A message box appears about macros added to additional files, why does this box appear? and how do I stop it from appearing every time I sart Outlook 2000? Alright, here is the repost Please state the full error you get. You can control macro's in Outlook by Tools-> Macro-> Security -- Roady [MVP] www.sparnaaij.net Microsoft Office and Microsoft Office related News Also Outlook FAQ, How To's, Downloads and more... Tips of th...

dynamic forms (i.e. form with hidden text boxes, calenders etc)
I have one form with 25 different text box, calenders and selection boxes on the are all hidden except one showing at a time (its being used for users to entered data). I need to put a progress bar, but as the number of input choices changes dependant on what the user enters, its not as simple as '1 of 25' the other idea is to put all the 25 catorgories on one side of the form and then display what the user has entered as they go along. (problem here is that it means 25 new text boxes !!) any one got any other ideas? This would be very hard as you stated you never know how man...

including data in combo box ??
Please help I need to include a price list in a combo box for selection. I want to pick it from a combo box and then enter the information in a cell Thanks Hi, Manny Try this: Menu Data > Validation > list I hope this hepls. "Manny" <manny@mdrsolutions.co.za> escreveu na mensagem news:e4adkk$pn5$1@ctb-nnrp2.saix.net... > Please help > > I need to include a price list in a combo box for selection. > I want to pick it from a combo box and then enter the information in a > cell > > Thanks > ...

Binding a Combo Box
Is it possible to bind 2 different columns of a combo box to a table? If so, can I bind those 2 columns to 2 different tables? Secondary Question: Is it possible to bind an entire record of a combo box to a table/query? If any of these are possible, how do you do that (the simpler the answer, the better.) Thank you A combo box can only have a single bound column. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) <pcstechnical.sfhs@gmail.com> wrote in message news:1190743242.886152.75330@y42g2000hsy.googlegroups.com... > Is it possible to bind ...

Duplicating data according to Dates
Well, that's the best description I can think of anyway. I need help with a solution. I have a set of data (vehicles) that I have managed to extract a complete history for. This dataset shows the month and year of every inspection that was completed on the vehicle according to the location that it was at when the inspection took place. Here is an example: Vehicle -- Location -- Year -- Month Car1 -- Location1 -- 2006 -- 9 Car1 -- Location2 -- 2006 -- 12 Car2 -- Location1 -- 2007 -- 2 Car2 -- Location2 -- 2006 -- 11 Car2 -- Location3 -- 2007 -- 5 Car3 -- Location1 -- 2006 -- 9 My goal is...

List Box and Updating the table
I want a form with 24 list boxes that the user can have multiple selections for each box..I understand that I need to have a table that will hold results and a new row for each selection, what i need to know is how do i get the data from the List boxes populated into the table? Thanks. Lisa, there are several problems with this. First, You will have to open the form on Friday and come back Monday to actually see it. I once tried a form with only 8 list boxes and it took 2 to 5 minutes to load the form. It has to retrieve the data from the database for each list box, one at a time. ...

new address lists not showing up in outlook client
Hello, for some reason any new address lists i create now do not show up in the outlook address book. please point me in a direction. Thanks Jon Is the client running Outlook 2003 in cached mode? "jon" <jgreen@alro.com> wrote in message news:340401c47ee8$d1914ed0$a301280a@phx.gbl... > Hello, > for some reason any new address lists i create now do not > show up in the outlook address book. please point me in a > direction. > > Thanks > Jon yes 2003 cached mode! >-----Original Message----- >Is the client running Outlook 2003 in cached mode? ...

Sections breaks and printing
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Hi, <br><br>I am trying to print a document that contains multiple section breaks, as some pages are landscape and others are portrait. When it comes to print, it is printed as multiple documents. This happens with PDF export both from the print dialog and the save as command. <br><br>I could print to PDF and then combine each file using acrobat pro, but this is a lot of work. Is there any way to either have different orientations (with different header and footers) without using page br...

Only run if check box is checked
I have some code that I only want to be run if a check box is checked. So I inserted an ActiveX check box which I have named cbRecord. I then put the following IF around the code which is initiated by clicking a spinner form control: If cbRecord.Value Then .... .... .... End If However, when the code is run I get the following error: Run time error '424': Object required. When I go to debug, the code doesn't even know that my check box exists. TIA...Geoff Try If Sheets("Sheet1").CheckBoxes("Check Box 1").Value = xlOn Then '...

Active X Checkbox moves after printing
I open an existing document with check boxes on the right half of the page and after printing the checkboxes move the the left column. I created a new excel spreadsheet and added check boxes and the same thing happened after printing. This is only happening on Office XP w/ SP3. I have tried on several machines with SP3 and it works fine. I upgraded one of the working machines to SP3 and the problem started happening. Has anyone had this problem? xl2002??? http://support.microsoft.com/default.aspx?scid=kb;EN-US;838910 Controls move to the left of the worksheet in Microsoft Excel 20...

Filtering a combo box...
Hi, I have a combo/dropdown box that shows all my customers (2000+) but obviously its difficult to find the exact customer i want.. The textbox part of the combo box will go to the first entry as i type which is ok but i would like it to filter down to show only the people that match what im typing as i type it.. for example i type "w" and the combo shows.. David Williams Walter Jones William Smith then i type the 'i' and get David Williams William Smith is this possible with a combo box? how come my inbox is not is not set in my left colun,and my delete word...

Excel Waiting List Help
I could use some help with an Excel Waiting List I am trying to create. My first column A is labeled Date and I formatted it as date. I have typed in 6/1/07 in A-1; I would like it when I type in in A-2 “6” the 1/07 is filled in already for me. The reason, this is a log of calls and there may be more than one entry call for that date. (Lazy typer) Also need help with column C. If in C-1 I type in Smith as the last name I would like it to type in for me “_mith” in C-6 if I type in S. Reason, this would tell me that person already called that day or in the past. Sounds like it might not...

Windows Update optional updates doesn't see
This is a multi-part message in MIME format. ------=_NextPart_000_0049_01CB1560.CEB60470 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit Hello there, for some time I can no longer view the optional updates. Can you tell me a solution? S.O.: Windows Vista Home Premium Service Pack 2. Language: Italian. I attach a screenshot. Thanks. Fabiano Liberatori ------=_NextPart_000_0049_01CB1560.CEB60470 Content-Type: image/jpeg; name="Windows Update Error.jpg" Content-Transfer-Encoding: bas...

Printing
When using Excel. Is it possible to set the print range for several tabs at once. The commands to format and enter data into multiple tabs does not work for setting print ranges. Excel does not allow you to set a printrange across multiple worksheets if thats what you mean by tabs "Pete Savoie" <psavoie@sptimes.com> wrote in message news:099101c3b073$d4aed0e0$a001280a@phx.gbl... > When using Excel. Is it possible to set the print range > for several tabs at once. The commands to format and > enter data into multiple tabs does not work for setting > print ran...