为什么这个SQL语句请求一个值?语句、SQL

由网友(我酷到天诛地灭)分享简介:我有一个表格,它可以让你添加名称表并显示在一个下拉菜单。当我点击的形式,就应该要求用户输入自己想加,然后单击确定按钮的名称。一旦用户点击OK,名称应存储在一个表中,并加入到下拉菜单每一件事情工作正常,但是当用户键入的文本框中的值并单击确定按钮弹出一个窗口要求输入参数值。无论用户在该参数值获取保存得到的文本框中的值的表...

我有一个表格,它可以让你添加名称表并显示在一个下拉菜单。 当我点击的形式,就应该要求用户输入自己想加,然后单击确定按钮的名称。一旦用户点击OK,名称应存储在一个表中,并加入到下拉菜单

每一件事情工作正常,但是当用户键入的文本框中的值并单击确定按钮弹出一个窗口要求输入参数值。无论用户在该参数值获取保存得到的文本框中的值的表来代替。我不知道为什么会这样。

名称是一个字符串,就是它的quatation马克?

下面是code:

 昏暗测试作为字符串
测试= Text1.Value
DoCmd.RunSQLINSERT INTO List_Of_Agencies(T_PI_GroupName)VALUES(&放大器;测试和安培;);
Form_0_Cover.Combo2.Requery
 

解决方案

  DoCmd.RunSQLINSERT INTO List_Of_Agencies(T_PI_GroupName)VALUES('&放大器;测试及放大器;')
 
请求一条sql语句s

I have a form which lets you add names to the table and shows it in a dropdown menu. When I click on the form, it should ask the user to enter the name they would like to add and click "ok". Once the user clicks ok, the name should be stored in a table and added to the drop-down menu.

Every thing works fine but when the user types the value in the textbox and clicks "ok" a window pops up asking for the parameter value. Whatever the user types in this parameter value gets saved in the table instead of getting the value from the textbox. I am not sure why this happens.

Name is a string, is it the quatation marks?

Here is the code:

Dim test As String
test = Text1.Value
DoCmd.RunSQL "INSERT INTO List_Of_Agencies(T_PI_GroupName)VALUES (" & test & ");"
Form_0_Cover.Combo2.Requery

解决方案

DoCmd.RunSQL "INSERT INTO List_Of_Agencies(T_PI_GroupName) VALUES ('" & test & "')"

阅读全文

相关推荐

最新文章