帮助查询或SQL选择语句..请 [英] Help with a Query or SQL select statement..please

查看:75
本文介绍了帮助查询或SQL选择语句..请的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Windows XP Pro,Access2003。

我有一个名为frmCheckSheet的表格和一个名为tblCheckSheet的表格。


表格上有是一个组合框cboSerialID,它是多列的,当选择序列号时,afterupdate事件会加载各种其他文本框,其中包含客户名称,部门,设备类型等。表单上的一个文本框是txtAssessment,它包含对检查项目...它链接到tblCheckSheet中的备注字段。


当用户创建新记录时,我希望将之前的评估加载到文本框中在表格上,他/她可以将这次设备的状况与之前检查的评估方式进行比较。此文本框将加载到cboSerialID的AfterUpdate事件上(以便它获取所需的工具)。

查询还需要在新记录(表格)上引用AutoDate(txtDate)文本框,以便它将之前的检查提取到今天的检查日期。 。


所以我想要这样的东西:


strSQL =" SELECT tblCheckSheet.Assessment from tblChecksheet WHERE tblCheckSheet.SerialID = cboSerialID.Column (0)" &安培; -

" AND tblCheckSheet.Date< txtDate"


有没有人知道确切的语法吗?我是否必须编写一份包含在声明中的函数?


希望以上内容是可以理解的,并再次感谢您的帮助。

Windows XP Pro , Access2003.

Hi I have a form called frmCheckSheet and a table called tblCheckSheet.

On the form there is a combobox cboSerialID which is multicolumn and when a serial number is selected the afterupdate event loads various other text boxes with customer name, department, type of equipment etc. One of the Text boxes on the form is txtAssessment, and it holds an assessment of the item checked...it is linked to a memo field in the tblCheckSheet.

When the user goes to create a new record I would like to have the previous assessment loaded into a textbox on the form so he/she can compare the condition of the equipment this time with how it was assessed the previous check. This Textbox would be loaded on the AfterUpdate event of the cboSerialID (so that it picks up the required instrument).
The query would also need to refer to the AutoDate (txtDate) Textbox on the new record (of the form)so that it picked up the previous check to whatever today''s check date happened to be.

So I would like something like:

strSQL = "SELECT tblCheckSheet.Assessment From tblChecksheet WHERE tblCheckSheet.SerialID = cboSerialID.Column(0)" & -
"AND tblCheckSheet.Date < txtDate"

Does anyone have any idea of the exact syntax please? Would I have to make up a function that is included in the statement?

Hope the above is understandable and again thanks for any assistance.

推荐答案

尝试

Try

展开 | 选择 | Wrap | 行号


HI Mary


再次感谢您的协助。我在你展示的时候尝试了它,但是我继续在声明的格式部分出现错误。


我尝试了没有格式但它仍然是错误但是出于不同的原因。如果我不添加Format语句,那么当我收到错误并进入调试模式并将鼠标悬停在显示cboSerialID的语句部分时,我会看到一个工具提示,显示为123456。在它中指示正确的序列号,如果我将鼠标悬停在txtDate上,那么我会看到正确的(即今天的)日期,例如23/12/2006。


我正在使用该语句作为querydef的一部分。


我尝试改变''和''以及\ \\ \\格式的开头和结尾但没有去。


不知道你在哪里,但新西兰圣诞快乐,希望你有一个美好的新年!
HI Mary

Thanks again for your assistance. I tried it as you showed but I keep on getting an error with the Format part of your statement.

I tried it without the format and it still errors but for a different reason. If I do not add the Format statement, then when I get the error coming up and I go to debug mode and hover with the mouse over the part of your statement that shows cboSerialID, I get like a tooltip appear with say "123456" in it indicating the correct serial number and if I hover over txtDate I then see the correct (i.e. todays) date as say 23/12/2006.

I am using the statement as part of a querydef.

I tried changing around the '' and '' and the \ \ at the beginning and end of the Format but no go.

Not sure where you are but Merry Christmas from New Zealand and hope you have a great new year!



HI Mary


再次感谢您的协助。我在你展示的时候尝试了它,但是我继续在声明的格式部分出现错误。


我尝试了没有格式但它仍然是错误但是出于不同的原因。如果我不添加Format语句,那么当我收到错误并进入调试模式并将鼠标悬停在显示cboSerialID的语句部分时,我会看到一个工具提示,显示为123456。在它中指示正确的序列号,如果我将鼠标悬停在txtDate上,那么我会看到正确的(即今天的)日期,例如23/12/2006。


我正在使用该语句作为querydef的一部分。


我尝试改变''和''以及\ \\ \\格式的开头和结尾但没有去。


不知道你在哪里,但新西兰圣诞快乐,希望你有一个美好的新年!
HI Mary

Thanks again for your assistance. I tried it as you showed but I keep on getting an error with the Format part of your statement.

I tried it without the format and it still errors but for a different reason. If I do not add the Format statement, then when I get the error coming up and I go to debug mode and hover with the mouse over the part of your statement that shows cboSerialID, I get like a tooltip appear with say "123456" in it indicating the correct serial number and if I hover over txtDate I then see the correct (i.e. todays) date as say 23/12/2006.

I am using the statement as part of a querydef.

I tried changing around the '' and '' and the \ \ at the beginning and end of the Format but no go.

Not sure where you are but Merry Christmas from New Zealand and hope you have a great new year!



圣诞快乐Zaphod


我会看看周二/周三。


Mary

Merry Christmas Zaphod

I''ll have a look at this Tuesday/Wednesday.

Mary


这篇关于帮助查询或SQL选择语句..请的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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