开发者

Creating a Form in Microsoft Access with VBA

开发者 https://www.devze.com 2023-03-16 09:30 出处:网络
I need help in creating a form that can query a database and generate reports in access. For eg: 开发者_开发知识库if I want to know what type of products that were sold in year 2010, I will select the

I need help in creating a form that can query a database and generate reports in access. For eg: 开发者_开发知识库if I want to know what type of products that were sold in year 2010, I will select the type of product from a "product combo box" and then will select the 2010 month from "month combo box". After clicking OK or RUN it would give me a list of all products for that month. It is possible to create such query form in access with the help of VBA? I would really appreciate your advice.

Thanks a lot.


Dim ssql as String
ssql = "SELECT * FROM your_table WHERE [Month]=" & Me.cboMonth & " AND [Prod]=" & Me.cboProd

DoCmd.OpenReport "Sales Report",,,,,,,ssql

http://msdn.microsoft.com/en-us/library/bb238032%28v=office.12%29.aspx

you may need if statement for checking how many parameter user select (checkboxs).

0

精彩评论

暂无评论...
验证码 换一张
取 消