WaldinTheAnalyst
Member
- Local time
- Today, 18:03
- Joined
- Sep 6, 2024
- Messages
- 34
Hi I'm developing my first access database, which is a bible database. So on my Books Form, I have a combobox "Book Name" from here I get to choose a book, thereafter I will click on a button "Open Verses" which will open a form "Verses" which is a split form, tabular ontop and datasheet at the bottom. this "Verses Form" should display the chapter number, verse number and text from the book I selected in the combobox in my "Books Form", however it only displays Genesis properties no matter which book I select in my combobox. below I've provided my buttons onclick event procedure. I have also attached 3 images of my 2 forms for visual clarity.
what I would like assistance on is how do I get my "Verses Form" to display results based on the Book I selected in the combobox every time.
Private Sub btnOpenBooksVerses_Click()
' Ensure the combo box is not empty
If Not IsNull(Me.comboSelectBook) Then
' Use Nz() to avoid errors with null values and pass the second column (book name)
Dim strBookName As String
strBookName = Nz(Me.comboSelectBook.Column(1), "")
' Open the Verses form and pass the selected book name in OpenArgs
If strBookName <> "" Then
DoCmd.OpenForm "frmVerses", , , , , , strBookName
Else
MsgBox "No book name found."
End If
Else
MsgBox "Please select a book."
End If
End Sub
what I would like assistance on is how do I get my "Verses Form" to display results based on the Book I selected in the combobox every time.
Private Sub btnOpenBooksVerses_Click()
' Ensure the combo box is not empty
If Not IsNull(Me.comboSelectBook) Then
' Use Nz() to avoid errors with null values and pass the second column (book name)
Dim strBookName As String
strBookName = Nz(Me.comboSelectBook.Column(1), "")
' Open the Verses form and pass the selected book name in OpenArgs
If strBookName <> "" Then
DoCmd.OpenForm "frmVerses", , , , , , strBookName
Else
MsgBox "No book name found."
End If
Else
MsgBox "Please select a book."
End If
End Sub