将此SQL语句帮助到VBA中 [英] Help with this SQL statement into VBA

查看:82
本文介绍了将此SQL语句帮助到VBA中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要一些SQL帮助作为组合框的事件。


选择c.Coach_Id,c.coach_first_name,c.coach_second_name

来自Coach c,coachrates cr

其中c.coach_ID = cr.coach_ID

和cr.sport_ID = me.comboSport.value

和工作日(me.comboDate.value)在



选择日期

来自coach_Availability

和我。 comboStarttime.value =时间




me.comboDate.value = dd / mm / yy

me.comboStarttime.value = hh:mm


我在其他数据库包上使用了SQL,MS Access语法不同(从不必指定连接类型)有时很难测试,因为我无法运行将此作为查询创建(或者我可以将me.combo.value作为参数接受吗?)


任何人都可以帮助我吗?

任何人都建议如何使用组合框测试使用表单上的值的SQL代码?


我以为我可以以某种方式将它们作为变量传递。

谢谢。

解决方案

这是什么逻辑?

展开 | 选择 | Wrap | 行号



这是什么逻辑?

展开 | 选择 | Wrap | 行号


< blockquote class =post_quotes>
这就是说:

只包括那些(命名)形式的'comboDate字段与子查询中的任何一个值匹配的值。



但是在第一行之外它是如何连接到原始查询的?


Need some help with some SQL below to use as an event for a combo box.

Select c.Coach_Id, c.coach_first_name, c.coach_second_name
from Coach c, coachrates cr
where c.coach_ID = cr.coach_ID
and cr.sport_ID = me.comboSport.value
and weekday(me.comboDate.value) in
(
Select day
from coach_Availability
and me.comboStarttime.value = time
)

me.comboDate.value = dd/mm/yy
me.comboStarttime.value = hh:mm

I have used SQL on other database packages, with MS Access syntax being different (never having to specifiy the join type) its sometimes difficult to test as I cant run this as creating this as a query (or can I, me.combo.value will just be accepted as parameters?)

Can anyone help me out?
Anyone recommend how to test SQL code that use values on form like here im using combo boxes?

Thought I could just somehow pass them in as variables.
Thanks.

解决方案

What is the logic of this?

Expand|Select|Wrap|Line Numbers


What is the logic of this?

Expand|Select|Wrap|Line Numbers


This is saying :
Include only those values where the (named) form''s comboDate field matches any one of the values in the subquery.

But outside of the first line how is it connected to the original query?


这篇关于将此SQL语句帮助到VBA中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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