PLEASE HELP....TOC item numbers

  • Thread starter kbrad28 via AccessMonster.com
  • Start date
K

kbrad28 via AccessMonster.com

Is there a way to number item in a report that shows some like this:


Apple Pie.........................................................1
Banan Nut Bread...............................................3

I one record continues to the next page how can you keep track of the report
numbering. In the current TOC I have it's placing everthing on page 1.....ANY
HELP OUT THERE!!
 
S

strive4peace

Make the following table in your database

*RptPages*
RecipeName, Text
FirstPage, integer
LastPage, integer

make a unique index on RecipeName

NOTE: Even better to use RecipeID if you have it

On your report, make the following textbox control:
Name--> PageNo
controlSource --> =Page

in the ReportHeader section OnFormat event, clear records that were
already in the RptPages table

dim s as string
s = "DELETE * FROM RptPages;"
currentdb.execute s
currentdb.tabledefs.refresh
DoEvents

then, in the OnFormat event of each Recipe group header section

dim s as string
s = "INSERT INTO RptPages " _
& " RecipeName, FirstPage) "
& " SELECT '" & me.RecipeName_controlname _
& "', " & me.pageNo & ";"
currentdb.execute s
currentdb.tabledefs.refresh
DoEvents

then, in the OnFormat event of each RecipeName group footer section

dim s as string
s = "UPDATE RptPages " _
& " SET LastPage = "
& me.pageNo _
& " WHERE RecipeName ='" _
& me.RecipeName & "';"
currentdb.execute s
currentdb.tabledefs.refresh
DoEvents

Now your table will be populated when you get to the report footer...
use a subreport in the Group Footer to show the information

to get the dots after the name, you can do something like this:

=[RecipeName] & replace(space(100)," ",".")

make sure CanGrow = no and the control will print until it runs out of
space


Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
K

kbrad28 via AccessMonster.com

One more question....Do you want me to add the Recipe ID on to the table
along with the other items or index by the Recipe ID instead of the recipe
name? I am a little confused on that. Also, what data will I use for the
subreport in the Group footer. I sorry to keep asking alot of question but I
am not that advance in Access.

Thanks so much crystal, I will try this out and let you know if I can get it
to work. THANKS AGAIN!!!

Kim
Make the following table in your database

*RptPages*
RecipeName, Text
FirstPage, integer
LastPage, integer

make a unique index on RecipeName

NOTE: Even better to use RecipeID if you have it

On your report, make the following textbox control:
Name--> PageNo
controlSource --> =Page

in the ReportHeader section OnFormat event, clear records that were
already in the RptPages table

dim s as string
s = "DELETE * FROM RptPages;"
currentdb.execute s
currentdb.tabledefs.refresh
DoEvents

then, in the OnFormat event of each Recipe group header section

dim s as string
s = "INSERT INTO RptPages " _
& " RecipeName, FirstPage) "
& " SELECT '" & me.RecipeName_controlname _
& "', " & me.pageNo & ";"
currentdb.execute s
currentdb.tabledefs.refresh
DoEvents

then, in the OnFormat event of each RecipeName group footer section

dim s as string
s = "UPDATE RptPages " _
& " SET LastPage = "
& me.pageNo _
& " WHERE RecipeName ='" _
& me.RecipeName & "';"
currentdb.execute s
currentdb.tabledefs.refresh
DoEvents

Now your table will be populated when you get to the report footer...
use a subreport in the Group Footer to show the information

to get the dots after the name, you can do something like this:

=[RecipeName] & replace(space(100)," ",".")

make sure CanGrow = no and the control will print until it runs out of
space

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
Is there a way to number item in a report that shows some like this:
[quoted text clipped - 4 lines]
numbering. In the current TOC I have it's placing everthing on page 1.....ANY
HELP OUT THERE!!
 
K

kbrad28 via AccessMonster.com

Hi Crystal,

I tried the code and now I am getting an compile error at the Me.
RecipeName_ControlName and I am not sure what to put there. I have paste a
copy of my report code..I have absolutely no idea what I am doing. I am
really new at this.

Option Compare Database

Private Sub GroupFooter1_Format(Cancel As Integer, FormatCount As Integer)
Dim s As String
s = "UPDATE RptPages " & " SET LastPage = " & Me.PageNo & " WHERE RecipeName
='" & Me.RecipeName & "';"
CurrentDb.Execute s
CurrentDb.TableDefs.Refresh
DoEvents

End Sub
Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
Dim s As String
s = "INSERT INTO RptPages " & " RecipeName, FirstPage) " & " SELECT '" & Me.
RecipeName_Controlname & "', " & Me.PageNo & ";"
CurrentDb.Execute s
CurrentDb.TableDefs.Refresh
DoEvents
End Sub

Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)
Dim s As String
s = "DELETE * FROM RptPages;"
CurrentDb.Execute s
CurrentDb.TableDefs.Refresh
DoEvents

End Sub
 
S

strive4peace

"I am getting an compile error at the RecipeName_ControlName"

You have to substitute the NAME property of your control in here...

************ Properties and Methods ************

Just like in the real world, every object has properties and methods.

Properties are like adjectives that describe an object

Methods are like verbs and define actions an object can do

For instance, you are a human and have properties such as hair color,
eye color, height, weight, ... and methods such as eat, walk, run, jump,
.... make babies -- Add to a collection :)

If you become familiar with the different types of objects that Access
can use and the properties that define them and the methods they can do
(and what triggers them), you will be on your way!

In the design view, you can show the property sheet, which will show
information for the selected item(s).

~~~~ turn on Properties window ~~~~

When you are in the design view, turn on/off the Properties window -->

1. from menu: View, Properties
OR
2. right-click and choose Properties from the shortcut menu

and then click on various objects. The properties window changes as you
change what is selected. If you have multiple objects selected, the
values for the properties they have in common will be displayed

Try it!

~~~~ setting Properties vs. resizing with handles ~~~~

I like to make the width of controls exact -- like 0.25, 0.3, 0.4, 0.5,
0.6, 0.75, 1, 1.25, etc

This is especially handing for lining up labels to controls under them

~~~~ selecting objects ~~~~

you can select multiple controls
1. click and drag the mouse and everything your imaginary rectangle
touches before you let go will be selected
OR
2. click, shift-click, etc
shift-click actually toggles the select status without affecting the
other items selected
OR
3. click (optionally, and drag) in a ruler
while the mouse is down, you will see a line extend across (vertical
ruler) or down (horizontal ruler)
if you click and drag, the ruler will turn dark indicating where you
started and stopped
-- everything the line/rectangle touches will be selected
OR
4. drop down the objects combo (left-most control on design toolbar) and
select something by its name

~~~~ select Form or Report ~~~~

To select the form (or report), you may:

1. click in the upper left corner where the rulers intersect
OR
2. click completely outside the design area in the dark gray space
OR
3. press CTRL-R
OR
4. from menu: Edit, Select Form/Report

~~~~ building event code ~~~

To build an event, click in the property sheet for the appropriate
object in the appropriate location and then click the builder (...)
button off to the right

Access will provide the procedure declaration and the procedure end --
you put the lines in between.

~~~~ Name property ~~~~

Procedures are NAMED according to the object name (except the form
object), so ALWAYS change the NAME property of any object to something
logical. For example, if you have a command button named cmdClose, its
event procedure may be something like this:

Private Sub cmdClose _Click()
If Me.Dirty Then Me.Dirty = False
DoCmd.Close acForm, Me.Name, acSaveNo
End Sub

When the properties window is displayed and only one thing is selected,
the Name appears in the title bar of the Properties window

If multiple items are selected, you will see "Multiple Selection" on the
title bar.

~~~~ ControlSource, SourceObject ~~~~

It is important to realize that the Name is NOT what is displayed in a
control. If the control is (for instance a textbox or combo box), you
will see the ControlSource displayed.

If the object is (for instance) a subform or subreport, what you see
displayed is the SourceObject

For bound objects, I like to make the Name property match the source
property (this does not, by the way, follow naming conventions, but for
me, it eases confusion)

As always, avoid using spaces and special characters when naming objects
-- use the underscore character _ to separate and use mixed case for
readability

~~~~ Recordset Property ~~~~

from the design view of a report or form:

turn on Properties
(from menu: View, Properties)

select the report or form
(click in the upper left where the rulers intersect)

click on the Data tab in Properties window

there you will see the RecordSet property
once you click in the property, you will see the builder button ... to
the right

If your report is based on a query, this takes you to the query design
screen

If your report is based on a SQL statement, you can modify it like the
design view of a query (you can also press SHIFT-F2 to use the Zoom Box
to change the SQL)

If your report is based on a table, you will be asked if you want to
make a query

~~~~ Builder Button ~~~~

The RowSource property for a combo or list box is like the RecordSource
property for a form or report -- you are choosing where the data will
come from that is displayed. The Builder Button ... will be displayed
when you click IN the property.

For choosing colors that are not on the color palette (like ForeColor,
BackColor, Bordercolor), click the builder button. Once in the palette
dialog box, click "Define Custom Colors" -- the dialog box will expand
and you can set the amounts for Red/Green/Blue or adjust
Hue/Saturation/Luminosity. There is also a slider control with a
triangle you can drag up or down to change the Luminosity (brightness).
I like to drag it up and fade out colors, especially for BackColor.

~~~~ Events ~~~~

"Properties" listed on the Events tab are actually methods ... such as
OnCurrent for form, AfterUpdate for Control, etc

~~~~ Learning Properties and Methods ~~~~

Explore the property sheet. Get familiar with how properties are
grouped on the tabs and the different properties for different objects.

~~~~ Help on Properties and Methods ~~~~

You can get help about any property by pressing F1 while in a property
on the property sheet where you want more information.

~~~~ Object Browser ~~~~

.... find out more about references... or just get Help!

in a code window to View the Object Browser:
1. from the menu --> View, Object Browser
OR
2. Press F2

On the left, you will probably see a Project window and a Properties
window below it
On the right, you will see the main Object Browser window

as you select a Class on the left, its members will appear in the pane
on the right

when you see something you want help on, press the F1 key and switch to
the Help window

When you are getting started, change the library to "VBA" (for instance,
instead of <all libraries>) and look at the classes (categories) of
functions -- click on a class and then click on a function in the right
pane. To get the help for that function, press F1

The VBA library is the most basic library and a great place to start
exploring.

To look up properties and methods for different objects like forms,
tabledefs, etc, change the library to Access
To look up ranges and sheets, change the library to Excel

explore the different libraries you have to pick from and see what is
available in each
(these are added or removed using Tools, References...)

when you are in the Object Browser window, the library that each
function/class is a member of is shown in the lower left corner of the
window

when you have an object selected, press F1 to get help.

~~~~ general help ~~~~

For general help, I find it interesting and informative to read the help
starting from the beginning of the Contents. In fact, if you have the
desire to print a ream of paper, it would be good to print it like a
book and read it so you can also take notes -- and you can read it away
from the computer -- a good time to put new information into your head
is just before you sleep ... let your subconscious figure it out!



Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
K

kbrad28 via AccessMonster.com

Ok, I tried changing the control name of RecipeName on the report and I am
still getting the compile error, so I have no idea what I am doing, but
thanks for your suggestions.
"I am getting an compile error at the RecipeName_ControlName"

You have to substitute the NAME property of your control in here...

************ Properties and Methods ************

Just like in the real world, every object has properties and methods.

Properties are like adjectives that describe an object

Methods are like verbs and define actions an object can do

For instance, you are a human and have properties such as hair color,
eye color, height, weight, ... and methods such as eat, walk, run, jump,
... make babies -- Add to a collection :)

If you become familiar with the different types of objects that Access
can use and the properties that define them and the methods they can do
(and what triggers them), you will be on your way!

In the design view, you can show the property sheet, which will show
information for the selected item(s).

~~~~ turn on Properties window ~~~~

When you are in the design view, turn on/off the Properties window -->

1. from menu: View, Properties
OR
2. right-click and choose Properties from the shortcut menu

and then click on various objects. The properties window changes as you
change what is selected. If you have multiple objects selected, the
values for the properties they have in common will be displayed

Try it!

~~~~ setting Properties vs. resizing with handles ~~~~

I like to make the width of controls exact -- like 0.25, 0.3, 0.4, 0.5,
0.6, 0.75, 1, 1.25, etc

This is especially handing for lining up labels to controls under them

~~~~ selecting objects ~~~~

you can select multiple controls
1. click and drag the mouse and everything your imaginary rectangle
touches before you let go will be selected
OR
2. click, shift-click, etc
shift-click actually toggles the select status without affecting the
other items selected
OR
3. click (optionally, and drag) in a ruler
while the mouse is down, you will see a line extend across (vertical
ruler) or down (horizontal ruler)
if you click and drag, the ruler will turn dark indicating where you
started and stopped
-- everything the line/rectangle touches will be selected
OR
4. drop down the objects combo (left-most control on design toolbar) and
select something by its name

~~~~ select Form or Report ~~~~

To select the form (or report), you may:

1. click in the upper left corner where the rulers intersect
OR
2. click completely outside the design area in the dark gray space
OR
3. press CTRL-R
OR
4. from menu: Edit, Select Form/Report

~~~~ building event code ~~~

To build an event, click in the property sheet for the appropriate
object in the appropriate location and then click the builder (...)
button off to the right

Access will provide the procedure declaration and the procedure end --
you put the lines in between.

~~~~ Name property ~~~~

Procedures are NAMED according to the object name (except the form
object), so ALWAYS change the NAME property of any object to something
logical. For example, if you have a command button named cmdClose, its
event procedure may be something like this:

Private Sub cmdClose _Click()
If Me.Dirty Then Me.Dirty = False
DoCmd.Close acForm, Me.Name, acSaveNo
End Sub

When the properties window is displayed and only one thing is selected,
the Name appears in the title bar of the Properties window

If multiple items are selected, you will see "Multiple Selection" on the
title bar.

~~~~ ControlSource, SourceObject ~~~~

It is important to realize that the Name is NOT what is displayed in a
control. If the control is (for instance a textbox or combo box), you
will see the ControlSource displayed.

If the object is (for instance) a subform or subreport, what you see
displayed is the SourceObject

For bound objects, I like to make the Name property match the source
property (this does not, by the way, follow naming conventions, but for
me, it eases confusion)

As always, avoid using spaces and special characters when naming objects
-- use the underscore character _ to separate and use mixed case for
readability

~~~~ Recordset Property ~~~~

from the design view of a report or form:

turn on Properties
(from menu: View, Properties)

select the report or form
(click in the upper left where the rulers intersect)

click on the Data tab in Properties window

there you will see the RecordSet property
once you click in the property, you will see the builder button ... to
the right

If your report is based on a query, this takes you to the query design
screen

If your report is based on a SQL statement, you can modify it like the
design view of a query (you can also press SHIFT-F2 to use the Zoom Box
to change the SQL)

If your report is based on a table, you will be asked if you want to
make a query

~~~~ Builder Button ~~~~

The RowSource property for a combo or list box is like the RecordSource
property for a form or report -- you are choosing where the data will
come from that is displayed. The Builder Button ... will be displayed
when you click IN the property.

For choosing colors that are not on the color palette (like ForeColor,
BackColor, Bordercolor), click the builder button. Once in the palette
dialog box, click "Define Custom Colors" -- the dialog box will expand
and you can set the amounts for Red/Green/Blue or adjust
Hue/Saturation/Luminosity. There is also a slider control with a
triangle you can drag up or down to change the Luminosity (brightness).
I like to drag it up and fade out colors, especially for BackColor.

~~~~ Events ~~~~

"Properties" listed on the Events tab are actually methods ... such as
OnCurrent for form, AfterUpdate for Control, etc

~~~~ Learning Properties and Methods ~~~~

Explore the property sheet. Get familiar with how properties are
grouped on the tabs and the different properties for different objects.

~~~~ Help on Properties and Methods ~~~~

You can get help about any property by pressing F1 while in a property
on the property sheet where you want more information.

~~~~ Object Browser ~~~~

... find out more about references... or just get Help!

in a code window to View the Object Browser:
1. from the menu --> View, Object Browser
OR
2. Press F2

On the left, you will probably see a Project window and a Properties
window below it
On the right, you will see the main Object Browser window

as you select a Class on the left, its members will appear in the pane
on the right

when you see something you want help on, press the F1 key and switch to
the Help window

When you are getting started, change the library to "VBA" (for instance,
instead of <all libraries>) and look at the classes (categories) of
functions -- click on a class and then click on a function in the right
pane. To get the help for that function, press F1

The VBA library is the most basic library and a great place to start
exploring.

To look up properties and methods for different objects like forms,
tabledefs, etc, change the library to Access
To look up ranges and sheets, change the library to Excel

explore the different libraries you have to pick from and see what is
available in each
(these are added or removed using Tools, References...)

when you are in the Object Browser window, the library that each
function/class is a member of is shown in the lower left corner of the
window

when you have an object selected, press F1 to get help.

~~~~ general help ~~~~

For general help, I find it interesting and informative to read the help
starting from the beginning of the Contents. In fact, if you have the
desire to print a ream of paper, it would be good to print it like a
book and read it so you can also take notes -- and you can read it away
from the computer -- a good time to put new information into your head
is just before you sleep ... let your subconscious figure it out!

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
Hi Crystal,
[quoted text clipped - 31 lines]
 
S

strive4peace

you're welcome ;) please post the code you are using with your
modifications

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*


Ok, I tried changing the control name of RecipeName on the report and I am
still getting the compile error, so I have no idea what I am doing, but
thanks for your suggestions.
"I am getting an compile error at the RecipeName_ControlName"

You have to substitute the NAME property of your control in here...

************ Properties and Methods ************

Just like in the real world, every object has properties and methods.

Properties are like adjectives that describe an object

Methods are like verbs and define actions an object can do

For instance, you are a human and have properties such as hair color,
eye color, height, weight, ... and methods such as eat, walk, run, jump,
... make babies -- Add to a collection :)

If you become familiar with the different types of objects that Access
can use and the properties that define them and the methods they can do
(and what triggers them), you will be on your way!

In the design view, you can show the property sheet, which will show
information for the selected item(s).

~~~~ turn on Properties window ~~~~

When you are in the design view, turn on/off the Properties window -->

1. from menu: View, Properties
OR
2. right-click and choose Properties from the shortcut menu

and then click on various objects. The properties window changes as you
change what is selected. If you have multiple objects selected, the
values for the properties they have in common will be displayed

Try it!

~~~~ setting Properties vs. resizing with handles ~~~~

I like to make the width of controls exact -- like 0.25, 0.3, 0.4, 0.5,
0.6, 0.75, 1, 1.25, etc

This is especially handing for lining up labels to controls under them

~~~~ selecting objects ~~~~

you can select multiple controls
1. click and drag the mouse and everything your imaginary rectangle
touches before you let go will be selected
OR
2. click, shift-click, etc
shift-click actually toggles the select status without affecting the
other items selected
OR
3. click (optionally, and drag) in a ruler
while the mouse is down, you will see a line extend across (vertical
ruler) or down (horizontal ruler)
if you click and drag, the ruler will turn dark indicating where you
started and stopped
-- everything the line/rectangle touches will be selected
OR
4. drop down the objects combo (left-most control on design toolbar) and
select something by its name

~~~~ select Form or Report ~~~~

To select the form (or report), you may:

1. click in the upper left corner where the rulers intersect
OR
2. click completely outside the design area in the dark gray space
OR
3. press CTRL-R
OR
4. from menu: Edit, Select Form/Report

~~~~ building event code ~~~

To build an event, click in the property sheet for the appropriate
object in the appropriate location and then click the builder (...)
button off to the right

Access will provide the procedure declaration and the procedure end --
you put the lines in between.

~~~~ Name property ~~~~

Procedures are NAMED according to the object name (except the form
object), so ALWAYS change the NAME property of any object to something
logical. For example, if you have a command button named cmdClose, its
event procedure may be something like this:

Private Sub cmdClose _Click()
If Me.Dirty Then Me.Dirty = False
DoCmd.Close acForm, Me.Name, acSaveNo
End Sub

When the properties window is displayed and only one thing is selected,
the Name appears in the title bar of the Properties window

If multiple items are selected, you will see "Multiple Selection" on the
title bar.

~~~~ ControlSource, SourceObject ~~~~

It is important to realize that the Name is NOT what is displayed in a
control. If the control is (for instance a textbox or combo box), you
will see the ControlSource displayed.

If the object is (for instance) a subform or subreport, what you see
displayed is the SourceObject

For bound objects, I like to make the Name property match the source
property (this does not, by the way, follow naming conventions, but for
me, it eases confusion)

As always, avoid using spaces and special characters when naming objects
-- use the underscore character _ to separate and use mixed case for
readability

~~~~ Recordset Property ~~~~

from the design view of a report or form:
turn on Properties
(from menu: View, Properties)

select the report or form
(click in the upper left where the rulers intersect)

click on the Data tab in Properties window

there you will see the RecordSet property
once you click in the property, you will see the builder button ... to
the right

If your report is based on a query, this takes you to the query design
screen

If your report is based on a SQL statement, you can modify it like the
design view of a query (you can also press SHIFT-F2 to use the Zoom Box
to change the SQL)

If your report is based on a table, you will be asked if you want to
make a query

~~~~ Builder Button ~~~~

The RowSource property for a combo or list box is like the RecordSource
property for a form or report -- you are choosing where the data will
come from that is displayed. The Builder Button ... will be displayed
when you click IN the property.

For choosing colors that are not on the color palette (like ForeColor,
BackColor, Bordercolor), click the builder button. Once in the palette
dialog box, click "Define Custom Colors" -- the dialog box will expand
and you can set the amounts for Red/Green/Blue or adjust
Hue/Saturation/Luminosity. There is also a slider control with a
triangle you can drag up or down to change the Luminosity (brightness).
I like to drag it up and fade out colors, especially for BackColor.

~~~~ Events ~~~~

"Properties" listed on the Events tab are actually methods ... such as
OnCurrent for form, AfterUpdate for Control, etc

~~~~ Learning Properties and Methods ~~~~

Explore the property sheet. Get familiar with how properties are
grouped on the tabs and the different properties for different objects.

~~~~ Help on Properties and Methods ~~~~

You can get help about any property by pressing F1 while in a property
on the property sheet where you want more information.

~~~~ Object Browser ~~~~

... find out more about references... or just get Help!

in a code window to View the Object Browser:
1. from the menu --> View, Object Browser
OR
2. Press F2

On the left, you will probably see a Project window and a Properties
window below it
On the right, you will see the main Object Browser window

as you select a Class on the left, its members will appear in the pane
on the right

when you see something you want help on, press the F1 key and switch to
the Help window

When you are getting started, change the library to "VBA" (for instance,
instead of <all libraries>) and look at the classes (categories) of
functions -- click on a class and then click on a function in the right
pane. To get the help for that function, press F1

The VBA library is the most basic library and a great place to start
exploring.

To look up properties and methods for different objects like forms,
tabledefs, etc, change the library to Access
To look up ranges and sheets, change the library to Excel

explore the different libraries you have to pick from and see what is
available in each
(these are added or removed using Tools, References...)

when you are in the Object Browser window, the library that each
function/class is a member of is shown in the lower left corner of the
window

when you have an object selected, press F1 to get help.

~~~~ general help ~~~~

For general help, I find it interesting and informative to read the help
starting from the beginning of the Contents. In fact, if you have the
desire to print a ream of paper, it would be good to print it like a
book and read it so you can also take notes -- and you can read it away
from the computer -- a good time to put new information into your head
is just before you sleep ... let your subconscious figure it out!

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
Hi Crystal,
[quoted text clipped - 31 lines]
 
K

kbrad28 via AccessMonster.com

This is the code:

Option Compare Database

Private Sub GroupFooter1_Format(Cancel As Integer, FormatCount As Integer)
Dim s As String
s = "UPDATE RptPages " & " SET LastPage = " & Me.PageNo & " WHERE RecipeName
='" & Me.RecipeName & "';"
CurrentDb.Execute s
CurrentDb.TableDefs.Refresh
DoEvents

End Sub
Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
Dim s As String
s = "INSERT INTO RptPages " & " RecipeName, FirstPage) " & " SELECT '" & Me.
RecipeName_RecipeName1 & "', " & Me.PageNo & ";"
CurrentDb.Execute s
CurrentDb.TableDefs.Refresh
DoEvents
End Sub

Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)
Dim s As String
s = "DELETE * FROM RptPages;"
CurrentDb.Execute s
CurrentDb.TableDefs.Refresh
DoEvents

End Sub

----------------------------
I also tried changing the control name so many different way and I lost a lot
of sleep on this....and I know it something so darn simple and I am over
thinking this.

Thanks!
Kbrad28
you're welcome ;) please post the code you are using with your
modifications

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
Ok, I tried changing the control name of RecipeName on the report and I am
still getting the compile error, so I have no idea what I am doing, but
[quoted text clipped - 239 lines]
[quoted text clipped - 31 lines]
End Sub
 
S

strive4peace

did you make an unbound textbox control with Name property of PageNo?

which line is the compiler highlighting?

I see an error in this line, but nothing that the compiler would catch,
so this is not why it won't compile...

GroupHeader0_Format event, you are missing a parenthesis before
--> RecipeName, FirstPage)

replace this:
s = "INSERT INTO RptPages " & " RecipeName, FirstPage) " & " SELECT '" & Me.
RecipeName_RecipeName1 & "', " & Me.PageNo & ";"

with this:

s = "INSERT INTO RptPages (RecipeName, FirstPage) " _
& " SELECT '" & Me.RecipeName_RecipeName1 & "', " _
& Me.PageNo & ";"

since you have 2 literal strings next to each other, you can combine
them into one

instead of having a loooong line with an SQL statement (and they do get
much longer!), I like to use the line continuation sequence, space and
then underscore at the end of a continued line -- also makes code easier
to read. For SQL statements, each keyword starts a new line"

Is "RecipeName_RecipeName1" REALLY the Name of your control? If so, you
should consider a more concise name ... and why do you have a "1" after
it? Do you have more than one recipe name on each record? If it is not
the name, and you have no control with that name, you will get a
compiler error.


Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*


This is the code:

Option Compare Database

Private Sub GroupFooter1_Format(Cancel As Integer, FormatCount As Integer)
Dim s As String
s = "UPDATE RptPages " & " SET LastPage = " & Me.PageNo & " WHERE RecipeName
='" & Me.RecipeName & "';"
CurrentDb.Execute s
CurrentDb.TableDefs.Refresh
DoEvents

End Sub
Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
Dim s As String
s = "INSERT INTO RptPages " & " RecipeName, FirstPage) " & " SELECT '" & Me.
RecipeName_RecipeName1 & "', " & Me.PageNo & ";"
CurrentDb.Execute s
CurrentDb.TableDefs.Refresh
DoEvents
End Sub

Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)
Dim s As String
s = "DELETE * FROM RptPages;"
CurrentDb.Execute s
CurrentDb.TableDefs.Refresh
DoEvents

End Sub

----------------------------
I also tried changing the control name so many different way and I lost a lot
of sleep on this....and I know it something so darn simple and I am over
thinking this.

Thanks!
Kbrad28
you're welcome ;) please post the code you are using with your
modifications

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
Ok, I tried changing the control name of RecipeName on the report and I am
still getting the compile error, so I have no idea what I am doing, but
[quoted text clipped - 239 lines]
[quoted text clipped - 31 lines]
End Sub
 
K

kbrad28 via AccessMonster.com

Did you make an unbound textbox control with Name property of PageNo? Yes, I
do have the textbox control in the detail section of the report.
Which line is the compiler highlighting? It highlights s = "INSERT INTO
RptPages (RecipeName, FirstPage) " & " SELECT '" & Me.RecipeName_RecipeName1
& "', " & Me.PageNo & ";"

----> The compiler highlights at the period after ME.RecipeName_RecipeName1 <-
-----
did you make an unbound textbox control with Name property of PageNo?

which line is the compiler highlighting?

I see an error in this line, but nothing that the compiler would catch,
so this is not why it won't compile...

GroupHeader0_Format event, you are missing a parenthesis before
--> RecipeName, FirstPage)

replace this:
s = "INSERT INTO RptPages " & " RecipeName, FirstPage) " & " SELECT
'" & Me.RecipeName_RecipeName1 & "', " & Me.PageNo & ";"

with this:

s = "INSERT INTO RptPages (RecipeName, FirstPage) " _
& " SELECT '" & Me.RecipeName_RecipeName1 & "', " _
& Me.PageNo & ";"

since you have 2 literal strings next to each other, you can combine
them into one

instead of having a loooong line with an SQL statement (and they do get
much longer!), I like to use the line continuation sequence, space and
then underscore at the end of a continued line -- also makes code easier
to read. For SQL statements, each keyword starts a new line"

Is "RecipeName_RecipeName1" REALLY the Name of your control? If so, you
should consider a more concise name ... and why do you have a "1" after
it? Do you have more than one recipe name on each record? If it is not
the name, and you have no control with that name, you will get a
compiler error.

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
This is the code:
[quoted text clipped - 53 lines]
[quoted text clipped - 31 lines]
End Sub
 
S

strive4peace

you said, "The compiler highlights at the period after
ME.RecipeName_RecipeName1"

I do not believe that "RecipeName_RecipeName1" is the Name of your
control...

go to the design view of the report

turn on the Properties window if it is not showing
(from the menu --> View, Properties)

click on the control containing the Recipe Name

in the Properties window, click on the All tab

scroll to the top

What is:
1. Name
2. ControlSource

?

In the code, replace RecipeName_RecipeName1 with the real name for the
control (and if the name is not logical, then change the Name before you
use it in code).



Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*


Did you make an unbound textbox control with Name property of PageNo? Yes, I
do have the textbox control in the detail section of the report.
Which line is the compiler highlighting? It highlights s = "INSERT INTO
RptPages (RecipeName, FirstPage) " & " SELECT '" & Me.RecipeName_RecipeName1
& "', " & Me.PageNo & ";"

----> The compiler highlights at the period after ME.RecipeName_RecipeName1 <-
-----
did you make an unbound textbox control with Name property of PageNo?

which line is the compiler highlighting?

I see an error in this line, but nothing that the compiler would catch,
so this is not why it won't compile...

GroupHeader0_Format event, you are missing a parenthesis before
--> RecipeName, FirstPage)

replace this:
s = "INSERT INTO RptPages " & " RecipeName, FirstPage) " & " SELECT
'" & Me.RecipeName_RecipeName1 & "', " & Me.PageNo & ";"

with this:

s = "INSERT INTO RptPages (RecipeName, FirstPage) " _
& " SELECT '" & Me.RecipeName_RecipeName1 & "', " _
& Me.PageNo & ";"

since you have 2 literal strings next to each other, you can combine
them into one

instead of having a loooong line with an SQL statement (and they do get
much longer!), I like to use the line continuation sequence, space and
then underscore at the end of a continued line -- also makes code easier
to read. For SQL statements, each keyword starts a new line"

Is "RecipeName_RecipeName1" REALLY the Name of your control? If so, you
should consider a more concise name ... and why do you have a "1" after
it? Do you have more than one recipe name on each record? If it is not
the name, and you have no control with that name, you will get a
compiler error.

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
This is the code:
[quoted text clipped - 53 lines]
[quoted text clipped - 31 lines]
End Sub
 
K

kbrad28 via AccessMonster.com

What is:
1. Name ---->RecipeName1
2. ControlSource------> RecipeName
you said, "The compiler highlights at the period after
ME.RecipeName_RecipeName1"

I do not believe that "RecipeName_RecipeName1" is the Name of your
control...

go to the design view of the report

turn on the Properties window if it is not showing
(from the menu --> View, Properties)

click on the control containing the Recipe Name

in the Properties window, click on the All tab

scroll to the top

What is:
1. Name
2. ControlSource

?

In the code, replace RecipeName_RecipeName1 with the real name for the
control (and if the name is not logical, then change the Name before you
use it in code).

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
Did you make an unbound textbox control with Name property of PageNo? Yes, I
do have the textbox control in the detail section of the report.
[quoted text clipped - 54 lines]
[quoted text clipped - 31 lines]
End Sub
 
S

strive4peace

after you edit the code to say RecipeName1 where it now says
RecipeName_RecipeName1, does it compile?

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*


What is:
1. Name ---->RecipeName1
2. ControlSource------> RecipeName
you said, "The compiler highlights at the period after
ME.RecipeName_RecipeName1"

I do not believe that "RecipeName_RecipeName1" is the Name of your
control...

go to the design view of the report

turn on the Properties window if it is not showing
(from the menu --> View, Properties)

click on the control containing the Recipe Name

in the Properties window, click on the All tab

scroll to the top

What is:
1. Name
2. ControlSource

?

In the code, replace RecipeName_RecipeName1 with the real name for the
control (and if the name is not logical, then change the Name before you
use it in code).

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
Did you make an unbound textbox control with Name property of PageNo? Yes, I
do have the textbox control in the detail section of the report.
[quoted text clipped - 54 lines]
[quoted text clipped - 31 lines]
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top