Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 05-06-2005, 12:01 PM   #1
Member (3 bit)
 
Join Date: Sep 2004
Location: Pennsylvania
Posts: 7
Send a message via AIM to PunisherFan
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.
PunisherFan is offline   Reply With Quote
Old 05-06-2005, 12:09 PM   #2
Come in Ray...
 
faulkner132's Avatar
 
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) & "'"
faulkner132 is offline   Reply With Quote
Old 05-06-2005, 01:13 PM   #3
Member (3 bit)
 
Join Date: Sep 2004
Location: Pennsylvania
Posts: 7
Send a message via AIM to PunisherFan
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.
PunisherFan is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 07:22 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2