如何使用访问内置的可视化基本功能更改我的查询?具体来说,如何将我的变量值传递给SQL来执行查询? [英] How do I alter my query using access's inbuilt visual basic functionality? Specifically, how can I pass my variable value to SQL to execute the query?

查看:97
本文介绍了如何使用访问内置的可视化基本功能更改我的查询?具体来说,如何将我的变量值传递给SQL来执行查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有一个查询,其参数需要用户提供日期。



查询的SQL代码

I currently have a query with a parameter requiring date from the user.

SQL code for query

SELECT [Appointment Bookings].Appointment_ID, [Appointment Bookings].Patient_ID, Employee.Full_Name, [Appointment Bookings].Appointment_Date
FROM Employee INNER JOIN [Appointment Bookings] ON Employee.Employee_ID = [Appointment Bookings].Employee_ID
GROUP BY [Appointment Bookings].Appointment_ID, [Appointment Bookings].Patient_ID, Employee.Full_Name, [Appointment Bookings].Appointment_Date
HAVING ((([Appointment Bookings].Appointment_Date)=[Please enter the appointment date]))
ORDER BY [Appointment Bookings].Appointment_Date;



为了简化流程并消除人为错误,我在组合框中创建了一个包含可用日期的表单。



我想知道如何将组合框中的值传递给查询的Having子句,然后执行查询以将其显示给客户?



提前致谢:)



我的尝试:



我是视觉基础和节目的新学生,不了解访问的视觉基本功能?所以任何帮助都非常感谢和抱歉任何愚蠢的问题只是想从头学习。


To ease the process and remove human error, I have created a form with available dates in a combo box.

i would like to know how I can pass the value from the combo box to the query's Having clause and then execute the query to display it to the customers?

Thanks in advance :)

What I have tried:

I a new student to visual basic and show don't know about access's visual basic capability? So any help is much appreciated and sorry any dumb questions just trying to learn from scratch.

推荐答案

Google搜索是查找此类信息的好地方。以下是我使用的Google搜索:访问vba参数查询 - Google搜索 [ ^ ]逐步找到有关如何操作的图片指南:在Access表单中运行参数查询 - TechRepublic [ ^ ]
Google Search is a good place for finding this type of information. Here is a Google Search that I used: access vba parameter query - Google Search[^] to find this step-by-step with pictures guide on how to do it: Run a parameter query within an Access form - TechRepublic[^]


这篇关于如何使用访问内置的可视化基本功能更改我的查询?具体来说,如何将我的变量值传递给SQL来执行查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆