将选定的记录插入vb6中的另一个表并访问 [英] Insert selected records to another table in vb6 and access
问题描述
亲爱的所有人,
我在vb6中遇到问题,访问非常糟糕.
我已经在VB6和访问中开发了一个小型应用程序.我想从表A中选择2个字段(只有两个字段,即调查和比率),然后根据表A中的条件将表A中的选定字段插入表B中.
我已经编写了以下代码,但出现以下错误
vb6-runtime-error-2147217900-(80040e14)
代码如下
Dear All,
I am facing a problem in vb6 and access very badly.
I have been developing a small application in VB6 and access. I want to select 2 fields from table A (which has only two fields viz investigation and rate) and insert the selected fields from table A to table B based on a condition from table A.
I have written the following code but i am getting the following error
vb6-runtime-error-2147217900-(80040e14)
The code is as under
Private Sub Command4_Click()
With Form1.list1.ListItems(Form1.list1.SelectedItem.Index)
sql = "select investigation.investigation, investigation.rate" & _
"from investigation where(((investigation.investigation)=" & (Form1.list1.SelectedItem.Text) & "));"
Connection
rs.Open sql, Con, adOpenDynamic
If Not rs.EOF Then
Text3.Text = rs!investigation
Text4.Text = rs!rate
End If
rs.Close
Con.Close
Set Con = Nothing
End With
End Sub
请帮忙
Sarfaraz
Please help
Sarfaraz
推荐答案
80040e14是访问语法错误
http://www.mikesdotnetting.com/Article/76/80040E14-MS- Access-Syntax-Error-messages [ ^ ]
可能您使用的表名和列名是相同的(investigation.investigation),您应该避免使用-只会使事情变得混乱.尝试将您的列重命名为其他名称.
在旁注中,它是2012年-您可以免费下载Visual Studio Express和SQL Express.有一些不错的开发工具!为什么要用最痛苦的配对VB6和Access伤害自己. :)
80040e14 is an Access Syntax Error
http://www.mikesdotnetting.com/Article/76/80040E14-MS-Access-Syntax-Error-messages[^]
Possibly your use of table and column names being the same (investigation.investigation), which you should avoid really - just confuses things. Try renaming your column to something else.
On a sidenote, it''s 2012 - you can download Visual Studio Express, SQL Express, all for free & have some decent development tools! Why are you hurting yourself with VB6 and Access, the most painful of pairings. :)
解决方案在这里
The solution is here
sql = "select Investigation.Investigation, Investigation.rate " & _
"from Investigation WHERE (((Investigation.Investigation) = '" & Form1.List1.SelectedItem.Text & "'));"
谢谢大家
Thank you all guys
这篇关于将选定的记录插入vb6中的另一个表并访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!