473,804 Members | 2,812 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Displaying records on a form...

Hi everyone,

I am relatively new to VB.Net, and database programming.
I have a database with four tables, set up as follows:

tblBook
BookID... key
Book... All the book titles of the Bible
tblChapter
ChapterID... key
Chapter... chapter numbers (1 - 150)
tblVerse
VerseID... key
Verse... verse number (1 - 100)
tblVerseText
ID... key
BookID
ChapterID
VerseID
VerseText... Each verse from the Bible, each in its own record

In VB.Net, I have a form with three ComboBoxes and one Label:

cmbBook... to display all the Book titles
cmbChapter... to display all the Chapter numbers
cmbVerse... to display all the verse numbers
lblVerseText... to display the verse corresponding to the selections made in
the three ComboBoxes

I can get each ComboBox to display the information from the corresponding
tables, however, I want to be able to filter each subsequent ComboBox, and
the label, to display only the information that is common to the preceding
selection.

For example:

You select 'Genesis' in cmbBook, and cmbChapter will only display the
numbers 1 - 22, (the number of chapters in Genesis).
Then you select '1' in cmbChapter, and cmbVerse will only display the
numbers 1 - 31, (the number of verses in Genesis-1).
Then you select '1' in cmbVerse, and lblVerseText will only display the
verse Genesis,1,1.

As I stated earlier, I can get each ComboBox to display ALL of the
corresponding data from their respective tables, but I would like to filter
the data according to the data currently selected in any of the COmboBoxes.

Any help would be gretly appreciated,

Gary
Nov 20 '05
15 1523
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Cor,

My method works like a charm!

I had the wrong item selected in cmbChapter.Valu eMember.

It just didn't make sense that the SQL statements would work in the
Builder but not when I ran the program.

So, I will try not to make too many changes at a time... LOL

Thanks for all the help so far!

You don't GIVE the answer... you DIRECT to the answer... A much
better way as far as I'm concerned.

Happy Holidays and Happy New Year!

Gary

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.8 for non-commercial use <http://www.pgp.com>

iQA/AwUBP+/Akj8KnwrkurVSEQ I3bwCgq+Mcqd+2R aJ8FtQOSDNEsSnh usIAnjvg
Br2nwwik5MqTWqC ZwfOV+RpE
=Sjmw
-----END PGP SIGNATURE-----
Nov 20 '05 #11
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

OOPS,

Now I get a 'System.IndexOu tOfRangeExcepti on' error at the following
point:

Private Sub cmbVerse_Select edIndexChanged( ByVal sender As
System.Object, ByVal e As System.EventArg s) Handles
cmbVerse.Select edIndexChanged

'Code to populate lblText

HERE-> daText.SelectCo mmand.Parameter s("VerseID)").V alue =
cmbVerse.Select edValue

daText.SelectCo mmand.Parameter s("ChapterID"). Value
= cmbChapter.Sele ctedValue

daText.SelectCo mmand.Parameter s("BookID").Val ue =
cmbBook.Selecte dValue

'Clear and populate lblText

dsText.Clear()

daText.Fill(dsT ext)

End Sub

It's late, I'll look into it tomorrow,

Gray

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.8 for non-commercial use <http://www.pgp.com>

iQA/AwUBP+/Ihz8KnwrkurVSEQ I3ewCgz47ZHl4CC wKppkHA6iLLIJkd LLEAoJMq
7YPjGhKTg/ecLseEooK0GHZq
=SH7q
-----END PGP SIGNATURE-----
Nov 20 '05 #12
Cor
Hi Gray,

The Selected Index changed fires everytime that there is something changed
in that combobox.
Therefore you have to stop it while initializing using a switch/bool/flag.

I use the Selected Index change commited, but I think it has a bug.

I thought it works fine for me if i am using it with a dataset binded to the
datasource of the combobox

(I thought that the bug is that without a datasource it gives the previous
selectedvalue).

You can try that also, but check it well if it is working correct.

I hope this goes again?

Cor
"> OOPS,

Now I get a 'System.IndexOu tOfRangeExcepti on' error at the following
point:

Private Sub cmbVerse_Select edIndexChanged( ByVal sender As
System.Object, ByVal e As System.EventArg s) Handles
cmbVerse.Select edIndexChanged

'Code to populate lblText

HERE-> daText.SelectCo mmand.Parameter s("VerseID)").V alue =
cmbVerse.Select edValue

daText.SelectCo mmand.Parameter s("ChapterID"). Value
= cmbChapter.Sele ctedValue

daText.SelectCo mmand.Parameter s("BookID").Val ue =
cmbBook.Selecte dValue

'Clear and populate lblText

dsText.Clear()

daText.Fill(dsT ext)

End Sub

Nov 20 '05 #13
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Cor,

Do you see anything wrong with this line?

daText.SelectCo mmand.Parameter s("VerseID)").V alue =
cmbVerse.Select edValue

When I made the correction everything works great.
Now all that is left is to embelish the UI for the program.

I am looking for people to try it out, it is very basic at this
point, but with 35,845 records in tblVerseText, (all the verses from
the Douay-Rheims Bible), there is still some editing to do. (Mostly
typing errors ) :-)

Is there a place I can post my little program for others to see and
use?

Thanks for all the help,

Gary

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.8 for non-commercial use <http://www.pgp.com>

iQA/AwUBP/DWxj8KnwrkurVSE QIDtACgkVFiJOWM s4NYg0TB8BXCs1o Gi5IAn3I4
DuzkrqSNIGwldFQ 4Ld564qZ0
=5vKK
-----END PGP SIGNATURE-----
Nov 20 '05 #14
Cor
Hi Gray,

daText.SelectCo mmand.Parameter s("VerseID)").V alue =
cmbVerse.Select edValue
I really do not know.
I do not use it, I also did look to the documentation for this, because I
thought this was giving the error, but why I do not know. (It is also very
slightly in the documentation)
Is there a place I can post my little program for others to see and
use?


I would not do that Gray, but when you see messages here with what you can
help others, you can cut out snippets and past them in as examples.

Cor
Nov 20 '05 #15
Cor,
daText.SelectCo mmand.Parameter s("VerseID)").V alue =
cmbVerse.Select edValue
There is too many parentheses in the line above ;)
Is there a place I can post my little program for others to see and
use?


I would not do that Gray, but when you see messages here with what you can
help others, you can cut out snippets and past them in as examples.


Absolutely, I will do that... Small price to pay for the help I have
received!

Thanks again,

Gary
Nov 20 '05 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3436
by: Tim Graichen | last post by:
Good morning, I have a sub-form that displays records from a table as a continuous form. The table has several hundred records, but the subform only displays five or six records. The records do include a date field. How can I force the sub form to display the most recent dates by default, verses forcing the user to scroll through all of the records to the bottom of the form in order to view the most recent entry or to add a new entry...
6
4086
by: Matt K. | last post by:
Hi there, I have a form in an Access project that contains a subform which displays the results of a query of the style "select * from where = #a certain date#". In the main part of the form the user can change the date, which will force a requery in the subform to bring up records from the date selected. My question is this... The query in the subform is a very simple one, with only three fields being returned. In the interest of...
3
3509
by: Robin S. | last post by:
I tried to ask this question several days ago, but I didn't explain my application correctly. Basically I want to have one record from table "A" and I want to display, say, 5 records from table "B" which are specified by the one record from table "A"... And all on the same form. I do not want to use a subform. The record fields from table "B" must be displayed in text boxes with the record fields from the single record from table "A". ...
5
2227
by: Robert | last post by:
Hello Accessors I have some reports created in Access that are very good for what they do. However, it seems to me that when you are displaying information you don't need to print out that a printer-friendly report is not the best way to go. So, I tried converting one of my Access reports to an Access form. I selected the continuous view to allow displaying multple records but when I went to define my sorting and grouping there was none...
5
5263
by: tdmailbox | last post by:
I have a form with a child form. In the child form there is a list of names that can grow quite large. On the parent form I want to display the first name from the child form. I set up a test box that is populated with the code =subfrm_media_review_sec_party.Form!first_name & " " & subfrm_media_review_sec_party.Form!last_name It works except that when I flip through the names it populates the parent form with the name of what ever...
9
2360
by: Susan Bricker | last post by:
Greetings. I am having trouble populating text data that represents data in my table. Here's the setup: There is a People Table (name, address, phone, ...) peopleID = autonumber key There is a Judge Table (information about judges) judgeID = autonumber key
3
4664
by: Lyn | last post by:
I need some guidance for a technique that will allow me to accomplish the following... I have a table in which each record contains a photograph. I would like to display in a form a thumbnail size version of each photograph horizontally across the form, then have the photgraphs "word wrap" (picture wrap ?) at the right end of the form onto the next "line" of photographs. Does anyone know how this can be done? Obviously, displaying...
0
1225
by: darrel | last post by:
Hi there, good day! i need some help in displaying my records,,, my assignment is i have to display a database records in a labels. Its like this in my database i have a table called "SUBJECTS" that is consists of 4 fields, SUBJECT CODE, SUBJECT, TYPE, & UNITS, i have input their all the data for my fields that have unique identifier. My problem i dont know how to display in my form. No in my form i have several of labels. in each...
1
2863
by: dheroan | last post by:
Hi there, I'm fairly new to using databases with VB .NET. I'm currently working on an application using a Microsoft Access database as a data source. I have created a form to display the fields for each record in a particular table (using the feature that allows you to drag and drop a field from a table in the database onto the form, automatically attaching a BindingNavigator and TableAdapter and all that jazz to it). As you probably know,...
0
1469
by: John Kirkpatrick | last post by:
Hi all, I am having difficulty displaying records on a frontend MS Access 2000 form using a MySQL backend. The following code works well with the Jet database engine but doesn't work properly using the MySQL backend database. All records are displayed on the form using the Jet, but only one record appears using MySQL. Perhaps it just needs some tweaking to work with MySQL. Any advice would be great. Thanks Function HelpDesc(HelpFrm As...
0
9576
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10311
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10074
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9138
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7613
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4292
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3813
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2988
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.