-
August 24th, 2013, 06:38 PM
#1
[RESOLVED] ListBox
Hi, I am new to coding so I am having a problem. I have a list box with bible verses loaded from a database. When I click on one of the verses to load it to a text window I get and error saying:
Run-time error '-2147217900 (80040e14)':
Syntax error (missing operstor) in query expression '[TextData] '%And now art thou cursed from the earth, which hath opened her mouth to recieve thy brothers blood from thy hand'.
Here is the code for that:
Code:
Private Sub List1_Click()
Dim Database As New ADODB.Connection
Dim txtName As String
txtName = List1
MousePointer = vbHourglass
With Database
Database.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & "\KJV.mdb;" 'open Database
End With
'On Error Resume Next
Set rs = New ADODB.Recordset 'set the recordset
rs.Open "SELECT * from BibleTable WHERE [TextData] '%" & txtName & "%'", Database, adOpenStatic, adLockPessimistic 'adLockReadOnly 'select location to search and cursor
Text2.Text = rs("BookTitle")
Text3.Text = rs("Chapter")
Text4.Text = rs("Verse")
Text5.Text = rs("TextData")
Me.MousePointer = vbNormal
MousePointer = 0
' rs.Close
' Set rs = Nothing 'set them to nothing
' Set cn = Nothing
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|