|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (3 bit)
|
A little VB help here...
I have a VB project that is giving me a difficult time. I have it search the database for all of my DVD's which it does, but as soon as I click one of the movies to get the information I get: run time error 3464 Datatype mismatch in criteria expression
I click debug and it goes right to this: Private Sub lstmovies_Click() Dim Listitem As Integer Listitem = Val(lstmovies.Text) Dim strQueryString As String strQueryString = "Title = " & CStr(Listitem) datmovies.Recordset.FindFirst strQueryString End Sub The yellow highlight is over this line: datmovies.Recordset.FindFirst strQueryString When I hover over it I get this: strQueryString ="Title = 0" Any ideas how to fix this? I'd greatly appreciate it. |
|
|
|
|
|
#2 |
|
Come in Ray...
Join Date: Sep 2004
Posts: 1,668
|
Try putting single quotes around your title:
strQueryString = "Title = " & CStr(Listitem) change to: 'add a single quote before and after the value strQueryString = "Title = '" & CStr(Listitem) & "'" |
|
|
|
|
|
#3 |
|
Member (3 bit)
|
That helped, but when I click on the movie title in the list box either nothing happens or it goes right to the first movie in my list. So if I click on Aliens in the list box it defaults back to my first movie which is Adventures of Ford Fairlane.
Here is the code I have for the search button: Private Sub cmdSearch_Click() Dim strQueryString As String, varBookMark As Variant varBookMark = datmovies.Recordset.Bookmark strQueryString = "Year LIKE '*" & Me.txtDescriptionSearch.Text & "*'" lstmovies.Clear datmovies.Recordset.FindFirst strQueryString Do Until datmovies.Recordset.NoMatch lstmovies.AddItem datmovies.Recordset("Title") datmovies.Recordset.FindNext strQueryString 'Find next 1 Loop datmovies.Recordset.Bookmark = varBookMark End Sub I know it's going to be something so simple. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|