Full Version: Create Report Button
UtterAccess Discussion Forums > Microsoft® Access > Access Reports
ryan_apessimisl
Hi everyone..
I'm new with microsoft access, and i'm learning how to use it..
i've been given a task of creating a data entry system using the microsoft access 2007...
I want to know how to create a button which have the function of creating new report when we click it..
And can we make it ask we to choose which field should be included in the report?
theDBguy
Hi,

welcome2UA.gif

In the Ribbon, Create tab, Reports group, there's a button called Report Wizard.

Will that work for you?

Just my 2 cents... 2cents.gif
ryan_apessimisl
QUOTE (theDBguy @ Feb 24 2012, 12:11 AM) *
Hi,

welcome2UA.gif

In the Ribbon, Create tab, Reports group, there's a button called Report Wizard.

Will that work for you?

Just my 2 cents... 2cents.gif

thanks.gif for replying, but i dont think that will work..
what i'm trying to do is some kind of button in a form which can give some kind of that report wizard function...
is it possible? iconfused.gif
i think it is the VBA code.. confused.gif
or not? can someone tell?
theDBguy
Hi,

In that case, you can try using something like:

DoCmd.RunCommand acCmdNewObjectReport

Just my 2 cents... 2cents.gif
ryan_apessimisl
QUOTE (theDBguy @ Feb 24 2012, 11:45 AM) *
Hi,

In that case, you can try using something like:

DoCmd.RunCommand acCmdNewObjectReport

Just my 2 cents... 2cents.gif



lol, this is the result..
is it sometin wrong?

i try this one, it work but the report is empty..
Dim rpt As Report

Set rpt = CreateReport
DoCmd.Restore

iconfused.gif
theDBguy
Hi,

I'm just curious... how exactly did you try my suggestion? Can you give us the step by step? Can you post the actual code you used that caused the error? Thanks.
ryan_apessimisl
QUOTE (theDBguy @ Feb 24 2012, 11:17 PM) *
Hi,

I'm just curious... how exactly did you try my suggestion? Can you give us the step by step? Can you post the actual code you used that caused the error? Thanks.


thanks for keep helping me with this problem, big_grin.gif
ok, i created a button..
then in the visual basic for application, I attach the code which u gave me...

Private Sub button_Click()
DoCmd.RunCommand acCmdNewObjectReport
End Sub

is it wrong?
iconfused.gif
theDBguy
Hi,

Thanks for the additional info. Just one more thing... Did you select [Event Procedure] in the Click event property for the button? If so, then maybe double-check that you have the Wizard installed or activated.

Just my 2 cents... 2cents.gif
ryan_apessimisl
QUOTE (theDBguy @ Feb 25 2012, 04:34 PM) *
Hi,

Thanks for the additional info. Just one more thing... Did you select [Event Procedure] in the Click event property for the button? If so, then maybe double-check that you have the Wizard installed or activated.

Just my 2 cents... 2cents.gif
Event Procedure? I don't really understand.. can explain a lil bit? confused.gif
theDBguy
Hi,

QUOTE (ryan_apessimisl @ Feb 26 2012, 05:56 AM) *
Event Procedure? I don't really understand.. can explain a lil bit? confused.gif

When I ask for the step-by-step, this is what I was expecting:

1. While in Form's Design View, added a Command Button
2. While the Command Button is selected, in the Properties Window, in the Event Tab, selected [Event Procedure] from the dropdown in the Click event
3. Clicked on the three dots (...) next to [Event Procedure]
4. In the Code Window, created the following:

Private Sub ButtonName_Click()
DoCmd.RunCommand acCmdNewObjectReport
End Sub

Hope that makes sense...
ryan_apessimisl
QUOTE (theDBguy @ Feb 26 2012, 12:01 PM) *
Hi,


When I ask for the step-by-step, this is what I was expecting:

1. While in Form's Design View, added a Command Button
2. While the Command Button is selected, in the Properties Window, in the Event Tab, selected [Event Procedure] from the dropdown in the Click event
3. Clicked on the three dots (...) next to [Event Procedure]
4. In the Code Window, created the following:

Private Sub ButtonName_Click()
DoCmd.RunCommand acCmdNewObjectReport
End Sub

Hope that makes sense...

Oh my gosh! It work!!!!
the report wizard popup as I click the button..
thanks.gif
you are really helpful and reliable woohoo.gif


but, after I tried that,
the report created as it should be,
just sometin not right popup...
theDBguy
Hi,

Glad to hear you're making progress. Try modifying the code to this:

Private Sub ButtonName_Click()
On Error GoTo errHandler

DoCmd.RunCommand acCmdNewObjectReport

errExit:
Exit Sub

errHandler:
If err.Number<>2501 Then
MsgBox err.Number & ": " & err.Description
End If
Resume errExit

End Sub

Just my 2 cents... 2cents.gif
ryan_apessimisl
QUOTE (theDBguy @ Feb 26 2012, 10:46 PM) *
Hi,

Glad to hear you're making progress. Try modifying the code to this:

Private Sub ButtonName_Click()
On Error GoTo errHandler

DoCmd.RunCommand acCmdNewObjectReport

errExit:
Exit Sub

errHandler:
If err.Number<>2501 Then
MsgBox err.Number & ": " & err.Description
End If
Resume errExit

End Sub

Just my 2 cents... 2cents.gif

the error dialog problem solve.. thanks.gif
i just wondering what are these codes means..
pullhair.gif
theDBguy
Hi,

yw.gif

Glad to hear you got it to work.

To learn more about Error Handling, take a look at this Wiki article: Error Handling

Good luck with your project.
ryan_apessimisl
QUOTE (theDBguy @ Feb 27 2012, 01:07 AM) *
Hi,

yw.gif

Glad to hear you got it to work.

To learn more about Error Handling, take a look at this Wiki article: Error Handling

Good luck with your project.

heh.. really hard for a newbie to do the project with 0 knowledge about microsoft access..
to be honest, i dont understand any of these codes meaning.. pullhair.gif
theDBguy
Hi,

Perhaps you could start with Crystal's Learn VBA tutorial.

Just my 2 cents... 2cents.gif
ryan_apessimisl
QUOTE (theDBguy @ Feb 27 2012, 12:13 PM) *
Hi,

Perhaps you could start with Crystal's Learn VBA tutorial.

Just my 2 cents... 2cents.gif

thanks.gif again, again and again big_grin.gif
are you the savior in UA? uarulez2.gif
now i've to start to learn from the start reading.gif
theDBguy
Hi,

Good luck with your learning. We all help out around here so just let us know if you have any more questions.

Cheers cheers.gif
ryan_apessimisl
QUOTE (theDBguy @ Feb 29 2012, 11:37 AM) *
Hi,

Good luck with your learning. We all help out around here so just let us know if you have any more questions.

Cheers cheers.gif

even though it's still not enough, i've learn a lot from you. thanks.gif
there're still a lot of things that i've tto learn and i'll ask you if you dont mind
uarulez2.gif
theDBguy
Hi Ryan,

QUOTE (ryan_apessimisl @ Feb 29 2012, 05:57 PM) *
even though it's still not enough, i've learn a lot from you. thanks.gif
there're still a lot of things that i've tto learn and i'll ask you if you dont mind
uarulez2.gif

Thanks. You're welcome around here, any time.

Good luck!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.