I have a form written in vb6 that the user is able to show listed items in a listbox from criteria from 4 different comboboxes. The data is being connected to an Access db. Where I am stuck at is after the search lists the data in the listbox the user is to select an item then click a command button that opens a new form, the new form has numerous textboxes, each corresponding to a field in the db, I need the textboxes to be filled with the record from the db that matches with the item that the user selected from the search screen. I am just confused if I should use an IF statement or a select query statement to fill all the listboxes. Any help would suffice. I already have the connection to the db through ADO code and I know how to fill the textboxes with the data, I just need to make sure that the textboxes are being filled with just the matching record from the search screen. Sorry this may be confusing. Any help would be great.
Recommended Answers
Jump to PostYes, a bit confusing. Without seeing the "big picture", I would allow user make the selection criteria in the first form. When user presses the button I would build a new SQL select statement with selection criteria, open the data form and show whatever was returned from the SQL statement.
…
Jump to Postsince you will need to display a lot of records why not use a grid instead of number of textboes.
Jump to PostYour code will actually display the last record found. Instead of the loop, check that the recordset is not empty and display only one (first) record. Add "Next"-button to the form and when the user presses Next, use recordset's MoveNext method and fill the textboxes with the second record. You …
All 11 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.