tina_303
11-25-2008, 06:18 PM
I am working an application for renting dvds. Right now I'm trying to create an event procedure for Checking Out movies, and would like some help.
What I would like it to do is the following:
After the movie(s) is select from the first list box, the result will display in the second list box. Then the user will clicks on the CALCULATE TOTAL amount command button and a user form will open up to do the following. (Up to here, I am good).
'find last cell in customer file worksheet
'if optRent is selected when Calculate Total button is click:
'input box to get Customer ID
'then take that customer Id and the movies from the MoviesSelect list box (aka: lstMoviesSelect)
'and make it the value of the last cell in Customer file worksheet for record
'in addition, the appriate amount owe should be calculated and display in the lblTotal
'BUT if optBuy is selected when Calculate Total button is click:
'Display the total amount owe only
Below is what I got going so far. I know that there are a lot of errors at the moment, so I'm hoping someone could help me out.
Private Sub cmdCalculate_Click()
Dim strCustomerId As String, rngData As Range, rngCell As Range, shtCustomerFile As Worksheet
Set shtCustomerFile = Application.Workbooks("project-let").woksheets("customer file")
FinalRow = shtCustomerFile.Cells(65536, 1).End(xlUp).Row
Set rngData = _
Application.Workbooks("project-let.xlsm").Worksheets("movie list").Range("a11").CurrentRegion
strMovieName = lstMoviesSelect.Value
For Each strMovieName In lstMoviesSelect
If optRent.Value = True Then
'input box for customer Id
strCustomerId = InputBox(prompt:="Enter customer ID", Title:="Customer ID")
shtCustomerFile.Cells(FinalRow, 1).End(xlUp).Row.Value = strMovieName And strCustomerId
lblTotal = rngData.Offset(columnoffset:=4).Value
Exit For
Else
If optBuy.Value = True Then
lblTotal = rngData.Offset(columnoffset:=5).Value
End If
End If
End Sub
I don't know if my description is clear enough to understand so I have attached a screen shot of what I got going so far. Please give me some help.
Thanks,
TL
What I would like it to do is the following:
After the movie(s) is select from the first list box, the result will display in the second list box. Then the user will clicks on the CALCULATE TOTAL amount command button and a user form will open up to do the following. (Up to here, I am good).
'find last cell in customer file worksheet
'if optRent is selected when Calculate Total button is click:
'input box to get Customer ID
'then take that customer Id and the movies from the MoviesSelect list box (aka: lstMoviesSelect)
'and make it the value of the last cell in Customer file worksheet for record
'in addition, the appriate amount owe should be calculated and display in the lblTotal
'BUT if optBuy is selected when Calculate Total button is click:
'Display the total amount owe only
Below is what I got going so far. I know that there are a lot of errors at the moment, so I'm hoping someone could help me out.
Private Sub cmdCalculate_Click()
Dim strCustomerId As String, rngData As Range, rngCell As Range, shtCustomerFile As Worksheet
Set shtCustomerFile = Application.Workbooks("project-let").woksheets("customer file")
FinalRow = shtCustomerFile.Cells(65536, 1).End(xlUp).Row
Set rngData = _
Application.Workbooks("project-let.xlsm").Worksheets("movie list").Range("a11").CurrentRegion
strMovieName = lstMoviesSelect.Value
For Each strMovieName In lstMoviesSelect
If optRent.Value = True Then
'input box for customer Id
strCustomerId = InputBox(prompt:="Enter customer ID", Title:="Customer ID")
shtCustomerFile.Cells(FinalRow, 1).End(xlUp).Row.Value = strMovieName And strCustomerId
lblTotal = rngData.Offset(columnoffset:=4).Value
Exit For
Else
If optBuy.Value = True Then
lblTotal = rngData.Offset(columnoffset:=5).Value
End If
End If
End Sub
I don't know if my description is clear enough to understand so I have attached a screen shot of what I got going so far. Please give me some help.
Thanks,
TL