C
Cathy W
Hi. I have a database with 3 tables - movies, rentals and customers. They
are all related. I have a movie form with MovieID, MovieTitle (from the
Movie Table) and Rented (from the Rented table). I have a subform on that
form that holds customer information from the Customer table. I have set up
a search form that has a combo box with movie titles bound to it. What I
want to happen is when a user selects a movie title from the combo box, if
the movie is rented then open the Movie form to show the information on the
rental. If it is not rented then display a message box to say "Movie not
rented". Here is the code I have on the combo box of the search form.
Private Sub cboSearch_AfterUpdate()
Dim stLinkCriteria As String
stLinkCriteria = " [MovieTitle] = '" & Me!cboSearch & "'"
If Form_frmMovie.Rented.Value = False Then
MsgBox "The movie you selected is not rented", vbOKOnly, "Movie Not
Rented"
ElseIf Form_frmMovie.Rented.Value = True Then
DoCmd.OpenForm "frmMovie", acNormal, , stLinkCriteria, acFormReadOnly
End If
End Sub
Hope someone can help!
are all related. I have a movie form with MovieID, MovieTitle (from the
Movie Table) and Rented (from the Rented table). I have a subform on that
form that holds customer information from the Customer table. I have set up
a search form that has a combo box with movie titles bound to it. What I
want to happen is when a user selects a movie title from the combo box, if
the movie is rented then open the Movie form to show the information on the
rental. If it is not rented then display a message box to say "Movie not
rented". Here is the code I have on the combo box of the search form.
Private Sub cboSearch_AfterUpdate()
Dim stLinkCriteria As String
stLinkCriteria = " [MovieTitle] = '" & Me!cboSearch & "'"
If Form_frmMovie.Rented.Value = False Then
MsgBox "The movie you selected is not rented", vbOKOnly, "Movie Not
Rented"
ElseIf Form_frmMovie.Rented.Value = True Then
DoCmd.OpenForm "frmMovie", acNormal, , stLinkCriteria, acFormReadOnly
End If
End Sub
Hope someone can help!