By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,107 Members | 1,323 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,107 IT Pros & Developers. It's quick & easy.

DataReport

P: 89
Hi all, I am using VBA with autoCAD interface, I have included database. However in BVA has no datareport, So how to I include datareport with VBA, Thx advance.
Jan 3 '08 #1
Share this Question
Share on Google+
9 Replies


puppydogbuddy
Expert 100+
P: 1,923
Hi all, I am using VBA with autoCAD interface, I have included database. However in BVA has no datareport, So how to I include datareport with VBA, Thx advance.
To output a report in VBA, you can (among other things):
output as an Access report created report designer
____________________________________________

DoCmd.OpenReport "yourReport", acViewPreview

or output and save as a Word rtf:
__________________________
DoCmd.OutputTo acOutputReport, strReportName, "c:\Temp\" & strReportName & ".rtf", False
Jan 3 '08 #2

P: 89
To output a report in VBA, you can (among other things):
output as an Access report created report designer
____________________________________________

DoCmd.OpenReport "yourReport", acViewPreview

or output and save as a Word rtf:
__________________________
DoCmd.OutputTo acOutputReport, strReportName, "c:\Temp\" & strReportName & ".rtf", False
Hi I make a report by using access and call it in vba code : DoCmd.OpenReport "yourReport", acViewPreview

one time it was run and i saw report but after that ...............
its say Run-Time error '2486"
You can't carry out this action at the present time

also want to if i send some query from from and add where condition in that case how report will be i mean query data i need to send from "from end"
Thx again
Jan 4 '08 #3

puppydogbuddy
Expert 100+
P: 1,923
Hi I make a report by using access and call it in vba code : DoCmd.OpenReport "yourReport", acViewPreview

one time it was run and i saw report but after that ...............
its say Run-Time error '2486"
You can't carry out this action at the present time

also want to if i send some query from from and add where condition in that case how report will be i mean query data i need to send from "from end"
Thx again
Hi shaiful,
My reference to "YourReport" was just to give you an example. You need to replace "YourReport" with the actual name of your report.

Not sure what you mean about sending query data "from end". If you are refering to front-end vs back-end, queries generally are in the front-end. The exception is a query known as a stored procedure, which is designed for server execution and therefore, resides with the server in the back-end.
Jan 5 '08 #4

P: 89
Hi shaiful,
My reference to "YourReport" was just to give you an example. You need to replace "YourReport" with the actual name of your report.

Not sure what you mean about sending query data "from end". If you are refering to front-end vs back-end, queries generally are in the front-end. The exception is a query known as a stored procedure, which is designed for server execution and therefore, resides with the server in the back-end.
Hi fisrt thx a lot 4 ur reply, I progress a lot on my project, however i stack only ---
I have a variavle such as dim Id as integer
and i want to send ot to database table for query condition where query will be select * from student where S_ID=" & ID & ",

But i dont know how to i send variables to the DB? Thx again
Jan 7 '08 #5

puppydogbuddy
Expert 100+
P: 1,923
Hi fisrt thx a lot 4 ur reply, I progress a lot on my project, however i stack only ---
I have a variavle such as dim Id as integer
and i want to send ot to database table for query condition where query will be select * from student where S_ID=" & ID & ",

But i dont know how to i send variables to the DB? Thx again
Still not sure what you want, but easiest way to update a table is to turn your select query into an update query, by changing the query type via the query button on the Access command menu, and executing it accordingly.

By the way your syntax on the select query is incorrect. It should be:

"select * from student where S_ID = " & ID
Jan 7 '08 #6

P: 89
Still not sure what you want, but easiest way to update a table is to turn your select query into an update query, by changing the query type via the query button on the Access command menu, and executing it accordingly.

By the way your syntax on the select query is incorrect. It should be:

"select * from student where S_ID = " & ID
Sorry Still i have a problem about variable with query. i mean how query will know or like with variable from form side?
Jan 7 '08 #7

puppydogbuddy
Expert 100+
P: 1,923
Sorry Still i have a problem about variable with query. i mean how query will know or like with variable from form side?
Ok, if you meant what you said, a variable can not be used directly in a query. What you can do is create a user defined function that references the variable, and then reference the Function in the query....or if you really meant a parameter, you can reference a parameter in the where clause of a query, for example.
Jan 8 '08 #8

P: 89
Ok, if you meant what you said, a variable can not be used directly in a query. What you can do is create a user defined function that references the variable, and then reference the Function in the query....or if you really meant a parameter, you can reference a parameter in the where clause of a query, for example.
Sorry 4 asking u a lot of Q, Actyally my problem is: i want to show some field on report from table and query will depend on user, such as serach by ID , just give me that idea pls. how query will recognize ID search? , thx again
Jan 9 '08 #9

puppydogbuddy
Expert 100+
P: 1,923
Sorry 4 asking u a lot of Q, Actyally my problem is: i want to show some field on report from table and query will depend on user, such as serach by ID , just give me that idea pls. how query will recognize ID search? , thx again

If you use a query as the record Source for the report, it would look like this:

"select * from student where S_ID = " & ID



If the S_ID in your report is not bound to the query, you could use the DLookup function to retrieve the S_ID
'
some control (textbox) in your report:
= DLookup("[ID]", "yourTableorQuery" , "S_ID = " & Report!ID)
Jan 9 '08 #10

Post your reply

Sign in to post your reply or Sign up for a free account.