VB SQL查询中的问题 [英] Problem in VB SQL Query

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

问题描述

Hii


我现在正在开展一个项目,我遇到了这个问题,我花了很多时间试图解决但不能...... />

我正在为数据库使用VB6和MS Access ..我的数据库中有一个名为TRequests的表,它的日期字段格式为Short Date(mm / dd / yyyy),字段的名称是ReqDate。


在表单上,​​用户应输入FromDate和ToDate,然后代码应检索ReqDate介于FromDate和ToDate之间的所有记录。 />

我的代码没有产生任何错误,但生成的报告没有显示和记录,记录源似乎是空的!!!


这是我的代码:

Hii

I am working on a project right now, and I have this problem that I spent lots of time trying to solve but couldn''t ....

I am using VB6 and MS Access for the database .. I have a table in my database called TRequests and it has a date field of the format Short Date (mm/dd/yyyy), the field''s name is ReqDate.

On the form the user should enter FromDate and ToDate , then the code should retrieve all records where ReqDate is between FromDate and ToDate ..

My code doesn''t produce any errors but the report generated doesn''t show and record and the record source seems to be empty !!!

Here is my code:

展开 | 选择 | Wrap | 行号

推荐答案




保留一个BreakPoint并检查FromDate和ToDate是否已正确填充。

当您从不同的控件构建日期+月份+年份的日期时,总是优先使用 DateSerial"功能..通过区域设置,日和月之间没有混淆..


问候

Veena
Hi,

Keep a BreakPoint and Check if FromDate and ToDate are bieng Populated properly.
When you are building a Date from a Day+Month+Year from different Controls, its always preferable to use "DateSerial" Function.. This way there is no confusion between Day and Month with Regional settings..


Regards
Veena






保留BreakPoint并检查FromDate和ToDate是否已正确填充。

当您从不同的控件构建日期+月份+年份的日期时,总是优先使用DateSerial。功能..通过区域设置,日和月之间没有混淆。



问候

Veena
Hi,

Keep a BreakPoint and Check if FromDate and ToDate are bieng Populated properly.
When you are building a Date from a Day+Month+Year from different Controls, its always preferable to use "DateSerial" Function.. This way there is no confusion between Day and Month with Regional settings..


Regards
Veena



我在调试模式下检查了FromDate和ToDate,它们正在以这种格式正确填充日期mm / dd / yyyy ...

I checked FromDate and ToDate in debug mode, they are being populated properly with dates in this format mm/dd/yyyy ...





尝试使用之间像这样:

Hi,

Try to use "Between" like this :

展开 | 选择 | Wrap | 行号


这篇关于VB SQL查询中的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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