B
BigMac
Hi there. I'm currently doing a volunteer project on setting up a
borrowing system for a small museum library using EXCEL and VBA,
however my knowledge of VBA is truly rudimentary, so I need a lot of
help from the experts here.
The main problem I face now is this: The library makes use of the Dewey
Decimal Number (DDN) system to keep track of its books. However this
DDN is not unique to each book i.e. one DDN can have many books.
As I did up my user form, everything was successful up till the point
whereby I set up a combobox which references to a book database. By
typing the DDN into a textbox, all the books having the same DDN should
appear in the combobox. My simple programming is as below:
Private Sub cmdFindBook_Click()
Dim MyRange As Variant
Dim MyRange2 As Variant
Dim colNumber As Long
MyRange = Sheets("Book Database").Range("B5:G1878").Value
MyRange2 = Sheets("Book Database").Range("C51878").Value
cbxBookTitle.Text = ""
lblAuthor.Caption = ""
On Error GoTo Errorhandler
If txtDDN.Text = "" Then
MsgBox ("Please enter Dewey Decimal Number.")
Else
cbxBookTitle.Text = Application.WorksheetFunction.VLookup(txtDDN.Text,
MyRange, 2, False)
lblAuthor.Caption =
Application.WorksheetFunction.VLookup(cbxBookTitle.Text, MyRange2, 2,
False)
End If
Exit Sub
Errorhandler:
MsgBox ("No book found.")
End Sub
Foolish me is unable to get a list of the books with the same DDN to
appear in the combo box drop down list. Can anyone give me any guidance
at all? I understand it might be something pretty complex, so thank you
guys for your help
Cheers!
Mac
borrowing system for a small museum library using EXCEL and VBA,
however my knowledge of VBA is truly rudimentary, so I need a lot of
help from the experts here.
The main problem I face now is this: The library makes use of the Dewey
Decimal Number (DDN) system to keep track of its books. However this
DDN is not unique to each book i.e. one DDN can have many books.
As I did up my user form, everything was successful up till the point
whereby I set up a combobox which references to a book database. By
typing the DDN into a textbox, all the books having the same DDN should
appear in the combobox. My simple programming is as below:
Private Sub cmdFindBook_Click()
Dim MyRange As Variant
Dim MyRange2 As Variant
Dim colNumber As Long
MyRange = Sheets("Book Database").Range("B5:G1878").Value
MyRange2 = Sheets("Book Database").Range("C51878").Value
cbxBookTitle.Text = ""
lblAuthor.Caption = ""
On Error GoTo Errorhandler
If txtDDN.Text = "" Then
MsgBox ("Please enter Dewey Decimal Number.")
Else
cbxBookTitle.Text = Application.WorksheetFunction.VLookup(txtDDN.Text,
MyRange, 2, False)
lblAuthor.Caption =
Application.WorksheetFunction.VLookup(cbxBookTitle.Text, MyRange2, 2,
False)
End If
Exit Sub
Errorhandler:
MsgBox ("No book found.")
End Sub
Foolish me is unable to get a list of the books with the same DDN to
appear in the combo box drop down list. Can anyone give me any guidance
at all? I understand it might be something pretty complex, so thank you
guys for your help
Cheers!
Mac