new record for new page of report

  • Thread starter Thread starter samicole246 via AccessMonster.com
  • Start date Start date
S

samicole246 via AccessMonster.com

hi
having problems regarding a repot..can i do this?when i click the add new
record command button the report page will begin to a new page..?so that if i
print (or click "print report")it will only print the record i enter for that
particular report..
can i do that?
 
samicole246 via AccessMonster.com wrote
having problems regarding a repot..can i do this?when i click the add new
record command button the report page will begin to a new page..?so that if i
print (or click "print report")it will only print the record i enter for that
particular report..


Very common question. Use code in the form button's Click
event to save the new record and then open the report using
the OpenReport method's WhereCondition argument to filter
the report to the current record. The code in the button's
Click event procedure should look something like:

Dim stDoc As String
Dim stCriteria As String

If Me.Dirty Then Me.Dirty = False ' save record
stDoc = "name of report"
stCriteria = "[name of pk field] = " Me.[name of pk field]
DoCmd.OpenReport stDoc, acViewPreview, , stCriteria
 
Marshall said:
having problems regarding a repot..can i do this?when i click the add new
record command button the report page will begin to a new page..?so that if i
print (or click "print report")it will only print the record i enter for that
particular report..

Very common question. Use code in the form button's Click
event to save the new record and then open the report using
the OpenReport method's WhereCondition argument to filter
the report to the current record. The code in the button's
Click event procedure should look something like:

Dim stDoc As String
Dim stCriteria As String

If Me.Dirty Then Me.Dirty = False ' save record
stDoc = "name of report"
stCriteria = "[name of pk field] = " Me.[name of pk field]
DoCmd.OpenReport stDoc, acViewPreview, , stCriteria
is there a code for wherecondition also that will i put on it?
 
samicole246 said:
Marshall said:
having problems regarding a repot..can i do this?when i click the add new
record command button the report page will begin to a new page..?so that if i
print (or click "print report")it will only print the record i enter for that
particular report..

Very common question. Use code in the form button's Click
event to save the new record and then open the report using
the OpenReport method's WhereCondition argument to filter
the report to the current record. The code in the button's
Click event procedure should look something like:

Dim stDoc As String
Dim stCriteria As String

If Me.Dirty Then Me.Dirty = False ' save record
stDoc = "name of report"
stCriteria = "[name of pk field] = " Me.[name of pk field]
DoCmd.OpenReport stDoc, acViewPreview, , stCriteria
is there a code for wherecondition also that will i put on it?


The OpenReport example I posted uses the WhereCondition
argument. If you're not familiar with the OpenReport
arguments, the quickest way to get information about them is
to look in VBA Help. WhereCondition is the 4th argument.

I just noticed that I left out a character in the stCriteria
string value. It should be:

stCriteria = "[name of pk field] = " & Me.[name of pk field]
 
Marshall said:
having problems regarding a repot..can i do this?when i click the add new
record command button the report page will begin to a new page..?so that if i [quoted text clipped - 16 lines]
is there a code for wherecondition also that will i put on it?

The OpenReport example I posted uses the WhereCondition
argument. If you're not familiar with the OpenReport
arguments, the quickest way to get information about them is
to look in VBA Help. WhereCondition is the 4th argument.

I just noticed that I left out a character in the stCriteria
string value. It should be:

stCriteria = "[name of pk field] = " & Me.[name of pk field]
thanks marshall ill try your codes right away...
 
Marshall said:
having problems regarding a repot..can i do this?when i click the add new
record command button the report page will begin to a new page..?so that if i [quoted text clipped - 16 lines]
is there a code for wherecondition also that will i put on it?

The OpenReport example I posted uses the WhereCondition
argument. If you're not familiar with the OpenReport
arguments, the quickest way to get information about them is
to look in VBA Help. WhereCondition is the 4th argument.

I just noticed that I left out a character in the stCriteria
string value. It should be:

stCriteria = "[name of pk field] = " & Me.[name of pk field]
i already check the site but all i got is just the sponsored links..can you give me the exact address of that site?thanks again..
 
samicole246 said:
Marshall said:
having problems regarding a repot..can i do this?when i click the add new
record command button the report page will begin to a new page..?so that if i
[quoted text clipped - 16 lines]
is there a code for wherecondition also that will i put on it?

The OpenReport example I posted uses the WhereCondition
argument. If you're not familiar with the OpenReport
arguments, the quickest way to get information about them is
to look in VBA Help. WhereCondition is the 4th argument.

I just noticed that I left out a character in the stCriteria
string value. It should be:

stCriteria = "[name of pk field] = " & Me.[name of pk field]
i already check the site but all i got is just the sponsored links..
can you give me the exact address of that site?

What site? Now I am completely lost.

Are you unaware of the Help features built into Access and
the VBA Editor??? (The VBA Editor is the window where you
see the procedure with the code we are trying to modify.)
 

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

Back
Top