Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Double Click on List box querys db

Status
Not open for further replies.

areric

Programmer
Jul 13, 2003
47
US
Im creating an application for a video rental store and i want to make it so that when you double click on a movie in the list box it queries the db and then fills in another text box called txtMovieName with the name of the movie. There will be other text boxes as well but if i can get the one to work i figure i can get the rest myself. I am doin the form in access. Currently I have code like this

Private Sub lboMovies_DoubleClick()
MsgBox ("HELLO")
Me.txtMovieName.RowSource = "SELECT MovieTitle from Movies_Table WHERE MovieID =" & Me.lboMovies
End Sub

The MsgBox was to test to see if the function was even getting called which it apparently wasnt.

Any ideas would be greatly appreciated. Thanks
 
this may be different and have nothing to do with your issue because i'm using a different version of Access, but when I tried to simulate what you described above, the procedure title defaulted to....

Private Sub lboMovies_DblClick()

instead of

Private Sub lboMovies_DoubleClick()

change the "Double" to "Dbl" and see what happens.

does this fix the problem?

 
It's a good thing the code isn't running since a text box doesn't have a RowSource property. List boxes, combo boxes, and graphs are a few controls that do have RowSource properties. A text box has a ControSource property which can't be a sql statement.

You could use code like.
Me.RecordSource = "SELECT * from Movies_Table WHERE MovieID =" & Me.lboMovies

Duane
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top