Book Library list boxes programed

mikevds

Music Library
Local time
Today, 11:08
Joined
Apr 29, 2005
Messages
69
I have tables with the following fields
Tablebookmaintable
fields
ID Book
Book Name
Author Number
Catagory
Subcatagory
Extra Catagory
Format
Pages
ISBN
Website
Publisher Number
Publisher Website
Copyright date
picture

Authorname Table
Author ID
Author lastname
Author firstname

Publisher Name Table
Publisher ID
Publisher Name
Number

Form
Same fields as Book Main Table includes
Tablebookmaintable
fields
ID Book
Book Name
Author Number
Catagory
Subcatagory
Extra Catagory
Format
Pages
ISBN
Website
Publisher Number
Publisher Website
Copyright date
picture


Now, please can someone help me out.

The three fields above the forms for the combo boxes I want to cascade or populate are
BookName 1 combo 14
AuthorNameLast combo 16
Publisher Name combo 18

I want to populate book name (combo 14)
and author name combo 16)
I get a combo box 16 error message
Also, here is the coding
Option Compare Database



Private Sub BookName_AfterUpdate()

End Sub

Private Sub Combo14_AfterUpdate()
On Error Resume Next
Combo18.RowSource = "Select ID,BookNAME " & _
"FROM Books Main Table " & _
"WHERE authornumber = " & Combo18.Value & _
" ORDER BY BookName;"
End Sub

Private Sub Combo16_AfterUpdate()

End Sub

Private Sub Combo18_AfterUpdate()
On Error Resume Next
Combo14.RowSource = "Select NamID, AuthorName " & _
"FROM tblAuthorName " & _
"WHERE AuthorType = " & Combo18.Value & _
" ORDER BY NamID;"
End Sub
Private Sub Combo18_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[ID] = " & Str(Me![Combo18])
Me.Bookmark = rs.Bookmark
End Sub


End Sub
I can't see what is wrong with the structure
Anyone is more then welcome to get this working for me.
I enclosed the sample file


I have two combo boxes to start with
The db is 808 KB the form size is 788,
I sure hope someone can help me out on this.

Regards
 
No sample, but I'll point this out:

Private Sub Combo14_AfterUpdate()
On Error Resume Next
Combo18.RowSource = "Select ID,BookNAME " & _
"FROM Books Main Table " & _
"WHERE authornumber = " & Combo18.Value & _
" ORDER BY BookName;"
End Sub

Further, the fields/tables in your code don't match up to your description of what you want to happen.
 
"FROM tblAuthorName " & _
"WHERE AuthorType = '" & Combo18.Value & _
"' ORDER BY NamID;"

currently your SQL looks like this:
"Select NamID, AuthorName FROM tblAuthorName WHERE AuthorType = myAuthorType ORDER BY NamID;"

VB will take myAuthorType as a variable and generate an error.
you want it to look like this:
"Select NamID, AuthorName FROM tblAuthorName WHERE AuthorType = 'myAuthorType' ORDER BY NamID;"

I tried doing the bottom one below
Private Sub Combo14_AfterUpdate()
On Error Resume Next
Combo18.RowSource = "Select ID,BookNAME " & _
"FROM Books Main Table " & _
"WHERE authornumber = " & Combo18.Value & _
" ORDER BY BookName;"
End Sub
But it displays a blank list for the combo 16 box which is authorname last

Hopefully someone can continue to help me out

The Author Type to generate an error do I use it for the combo 14 which is bookname and combo 16 which is author name?
 

Users who are viewing this thread

Back
Top Bottom