Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Header Form

Discussion in 'Information Technology' started by Sterdog, Nov 3, 2005.

Tags:
  1. Sterdog

    Sterdog
    Expand Collapse
    Guest

    How do I get my header to print out on all pages of my report?

    2nd question: I am using a macro to print preview my reports and then just
    printing a single record. Is there a way I can print ONLY the current record
    in looking at (in form View) from the report? I tried pasting codes

    "DoCmd.OpenReport "YourReport", acPreview
    Reports![YourReport].Filter = "YourPrimaryKey = " & Me![YourPrimaryKeyControl]
    Reports![YourReport].FilterOn = True"

    but I get a run time error or "DoCmd. macro doesnt exist" My table primary
    key is Record Number.

    Help please
     
  2. Loading...


  3. Nikos Yannacopoulos

    Nikos Yannacopoulos
    Expand Collapse
    Guest

    Sterdog,

    Re. q1, use the Page Header section instead of the Report Header; if no
    Page Header section exists in your report design, go View > Page Header
    / Footer in the menu.

    Re. q2:
    In Access, this is referred to as VBA code, a macro is a different
    "animal" (unlike Excel, which has probably caused the confusion).
    The way to pull the trick is to use a Where condition in your
    OpenReport, like:

    Dim strWhere As String
    strWhere = "YourPrimaryKey = " & Me![YourPrimaryKeyControl]
    DoCmd.OpenReport "YourReport", acViewPreview, , strWhere

    HTH,
    Nikos
     
  4. Sterdog

    Sterdog
    Expand Collapse
    Guest

    Nikos--Thanks

    I tried the script to no aveil. I looked in my Table to find the primary
    key and I am assuming it is the far left column that says: "Record Number"
    what is my "[YourPrimaryKeyControl]"--the name of my table???? Therefore,
    correct if wrong, I would paste the following in the 'onClick' in properties:

    Dim strWhere As String
    strWhere = "Record Number= " & Me![Record Number]
    DoCmd.OpenReport "Recon Form", acViewPreview, , strWhere

    Jeff


    "Nikos Yannacopoulos" wrote:

    > Sterdog,
    >
    > Re. q1, use the Page Header section instead of the Report Header; if no
    > Page Header section exists in your report design, go View > Page Header
    > / Footer in the menu.
    >
    > Re. q2:
    > In Access, this is referred to as VBA code, a macro is a different
    > "animal" (unlike Excel, which has probably caused the confusion).
    > The way to pull the trick is to use a Where condition in your
    > OpenReport, like:
    >
    > Dim strWhere As String
    > strWhere = "YourPrimaryKey = " & Me![YourPrimaryKeyControl]
    > DoCmd.OpenReport "YourReport", acViewPreview, , strWhere
    >
    > HTH,
    > Nikos
    >
     
  5. Nikos Yannacopoulos

    Nikos Yannacopoulos
    Expand Collapse
    Guest

    Jeff,

    The space in the fild name didn't make things any easier :)

    Try:

    strWhere = "[Record Number]= " & Me![Record Number]

    HTH,
    Nikos
     
  6. Sterdog

    Sterdog
    Expand Collapse
    Guest

    Here is what I have:

    strWhere = "[Record Number]= " & Me![Record Number]
    stsstDocName = "Recon form"
    DoCmd.OpenReport stDocName, acViewPreview, , strWhere


    Here is the error message: THe action or Method requires a report name
    argument


    "Nikos Yannacopoulos" wrote:

    > Jeff,
    >
    > The space in the fild name didn't make things any easier :)
    >
    > Try:
    >
    > strWhere = "[Record Number]= " & Me![Record Number]
    >
    > HTH,
    > Nikos
    >
     
  7. Nikos Yannacopoulos

    Nikos Yannacopoulos
    Expand Collapse
    Guest

    Jeff,

    You are trying to pass the report name as the value of variable
    stDocName, but according to your code, you have not assigned a value to
    it; instead, you have assigned the value "Recon form" to another
    variable, stsstDocName! Correct the decond line to:

    stDocName = "Recon form"

    HTH,
    Nikos
     
  8. Sterdog

    Sterdog
    Expand Collapse
    Guest

    Nikos: Thanks Buddy!!!! I got it to work.

    I am designing a balance sheet form, how do I make the ending balance of one
    record become the beginning balance of the new record?

    "Sterdog" wrote:

    > Here is what I have:
    >
    > strWhere = "[Record Number]= " & Me![Record Number]
    > stsstDocName = "Recon form"
    > DoCmd.OpenReport stDocName, acViewPreview, , strWhere
    >
    >
    > Here is the error message: THe action or Method requires a report name
    > argument
    >
    >
    > "Nikos Yannacopoulos" wrote:
    >
    > > Jeff,
    > >
    > > The space in the fild name didn't make things any easier :)
    > >
    > > Try:
    > >
    > > strWhere = "[Record Number]= " & Me![Record Number]
    > >
    > > HTH,
    > > Nikos
    > >
     
  9. Nikos Yannacopoulos

    Nikos Yannacopoulos
    Expand Collapse
    Guest

    It depends on the setup; the general idea is to look it up after you
    have calculated the [Record Nubber] of the previous record. If your
    Record Numbers are strictly sequenctial, all it takes is:

    Me.[Beginning Balance] = DLookup("[Ending Balance]", _
    "The Table / Query Name", _
    "[[Record Number]= " & Me![Record Number] - 1)

    Otherwise, if the numbers are strictlty ascending but with gaps:

    Dim intPreviousRecord As Long
    intPreviousRecord = DMAx("[Record Number]",_
    "The Table / Query Name", _
    "[[Record Number]< " & Me![Record Number])
    Me.[Beginning Balance] = DLookup("[Ending Balance]", _
    "The Table / Query Name", _
    "[[Record Number]= " & intPreviousRecord)

    In either case, put the code in the form's Current event.

    Note: his will just display the number without actually storing it in
    the table (you shouldn't store data twice), and it will only work in
    single form, not in datasheet or continuous forms view.

    Hint: maybe you should be using a report instead of a form here? It
    would be much easier to pull those tricks in a report. You are not doing
    any data entry in the form, are you? If not, reports are much more
    efficient for displaying than forms.

    Nikos
     
  10. Sterdog

    Sterdog
    Expand Collapse
    Guest

    Nikos:

    Do you or anyone you know do this for a living? I could figure it out, but
    it is too time consuming. I have a very basic need that would take someone
    about an hour or less.

    Jeff

    "Nikos Yannacopoulos" wrote:

    > It depends on the setup; the general idea is to look it up after you
    > have calculated the [Record Nubber] of the previous record. If your
    > Record Numbers are strictly sequenctial, all it takes is:
    >
    > Me.[Beginning Balance] = DLookup("[Ending Balance]", _
    > "The Table / Query Name", _
    > "[[Record Number]= " & Me![Record Number] - 1)
    >
    > Otherwise, if the numbers are strictlty ascending but with gaps:
    >
    > Dim intPreviousRecord As Long
    > intPreviousRecord = DMAx("[Record Number]",_
    > "The Table / Query Name", _
    > "[[Record Number]< " & Me![Record Number])
    > Me.[Beginning Balance] = DLookup("[Ending Balance]", _
    > "The Table / Query Name", _
    > "[[Record Number]= " & intPreviousRecord)
    >
    > In either case, put the code in the form's Current event.
    >
    > Note: his will just display the number without actually storing it in
    > the table (you shouldn't store data twice), and it will only work in
    > single form, not in datasheet or continuous forms view.
    >
    > Hint: maybe you should be using a report instead of a form here? It
    > would be much easier to pull those tricks in a report. You are not doing
    > any data entry in the form, are you? If not, reports are much more
    > efficient for displaying than forms.
    >
    > Nikos
    >
     
  11. Nikos Yannacopoulos

    Nikos Yannacopoulos
    Expand Collapse
    Guest

    Jeff,

    No, I'm afraid I don't do it for a living, though maybe I should
    consider it :)

    Many of the MVP's and some of the other frequent respondents in the NGs
    have their URL's in their "signature"; that's a good place to start looking.

    That said, if you don't expect you'll be engaging in another Access
    project then I wouldn't try to talk you out of commissioning this one,
    otherwise my advice is keep trying. Like with everything else, there is
    a learning curve involved here; what looks confusing and time consuming
    now, will soon be a walk in the park, and your up-front investment in
    time and effort will pay.


    Refgards,
    Nikos

    Sterdog wrote:
    > Nikos:
    >
    > Do you or anyone you know do this for a living? I could figure it out, but
    > it is too time consuming. I have a very basic need that would take someone
    > about an hour or less.
    >
    > Jeff
    >
    > "Nikos Yannacopoulos" wrote:
    >
    >
    >>It depends on the setup; the general idea is to look it up after you
    >>have calculated the [Record Nubber] of the previous record. If your
    >>Record Numbers are strictly sequenctial, all it takes is:
    >>
    >>Me.[Beginning Balance] = DLookup("[Ending Balance]", _
    >> "The Table / Query Name", _
    >> "[[Record Number]= " & Me![Record Number] - 1)
    >>
    >>Otherwise, if the numbers are strictlty ascending but with gaps:
    >>
    >>Dim intPreviousRecord As Long
    >>intPreviousRecord = DMAx("[Record Number]",_
    >> "The Table / Query Name", _
    >> "[[Record Number]< " & Me![Record Number])
    >>Me.[Beginning Balance] = DLookup("[Ending Balance]", _
    >> "The Table / Query Name", _
    >> "[[Record Number]= " & intPreviousRecord)
    >>
    >>In either case, put the code in the form's Current event.
    >>
    >>Note: his will just display the number without actually storing it in
    >>the table (you shouldn't store data twice), and it will only work in
    >>single form, not in datasheet or continuous forms view.
    >>
    >>Hint: maybe you should be using a report instead of a form here? It
    >>would be much easier to pull those tricks in a report. You are not doing
    >>any data entry in the form, are you? If not, reports are much more
    >>efficient for displaying than forms.
    >>
    >>Nikos
    >>
     
  12. Sterdog

    Sterdog
    Expand Collapse
    Guest

    Nikos:
    I am an expert in Excel, but Access is too much VB. I have done the
    complete layout I just need some functions put in certain reports and forms
    any interest in helping?

    Jeff

    "Nikos Yannacopoulos" wrote:

    > Jeff,
    >
    > No, I'm afraid I don't do it for a living, though maybe I should
    > consider it :)
    >
    > Many of the MVP's and some of the other frequent respondents in the NGs
    > have their URL's in their "signature"; that's a good place to start looking.
    >
    > That said, if you don't expect you'll be engaging in another Access
    > project then I wouldn't try to talk you out of commissioning this one,
    > otherwise my advice is keep trying. Like with everything else, there is
    > a learning curve involved here; what looks confusing and time consuming
    > now, will soon be a walk in the park, and your up-front investment in
    > time and effort will pay.
    >
    >
    > Refgards,
    > Nikos
    >
    > Sterdog wrote:
    > > Nikos:
    > >
    > > Do you or anyone you know do this for a living? I could figure it out, but
    > > it is too time consuming. I have a very basic need that would take someone
    > > about an hour or less.
    > >
    > > Jeff
    > >
    > > "Nikos Yannacopoulos" wrote:
    > >
    > >
    > >>It depends on the setup; the general idea is to look it up after you
    > >>have calculated the [Record Nubber] of the previous record. If your
    > >>Record Numbers are strictly sequenctial, all it takes is:
    > >>
    > >>Me.[Beginning Balance] = DLookup("[Ending Balance]", _
    > >> "The Table / Query Name", _
    > >> "[[Record Number]= " & Me![Record Number] - 1)
    > >>
    > >>Otherwise, if the numbers are strictlty ascending but with gaps:
    > >>
    > >>Dim intPreviousRecord As Long
    > >>intPreviousRecord = DMAx("[Record Number]",_
    > >> "The Table / Query Name", _
    > >> "[[Record Number]< " & Me![Record Number])
    > >>Me.[Beginning Balance] = DLookup("[Ending Balance]", _
    > >> "The Table / Query Name", _
    > >> "[[Record Number]= " & intPreviousRecord)
    > >>
    > >>In either case, put the code in the form's Current event.
    > >>
    > >>Note: his will just display the number without actually storing it in
    > >>the table (you shouldn't store data twice), and it will only work in
    > >>single form, not in datasheet or continuous forms view.
    > >>
    > >>Hint: maybe you should be using a report instead of a form here? It
    > >>would be much easier to pull those tricks in a report. You are not doing
    > >>any data entry in the form, are you? If not, reports are much more
    > >>efficient for displaying than forms.
    > >>
    > >>Nikos
    > >>

    >
     

Share This Page