Yes, 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.
There may be zero, one or multiple matching records, but like I said, I don't see the "big picture" ;)
Teme64
Veteran Poster
1,031 posts since Aug 2008
Reputation Points: 218
Solved Threads: 203
since you will need to display a lot of records why not use a grid instead of number of textboes.
debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
Your 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 may also add "Prev"-button and in the similar way allow user to "navigate" between all the records found.
Teme64
Veteran Poster
1,031 posts since Aug 2008
Reputation Points: 218
Solved Threads: 203
Your code is then ok. Assuming you do get only one record :)
Teme64
Veteran Poster
1,031 posts since Aug 2008
Reputation Points: 218
Solved Threads: 203