Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command Button to Open Input Box, Find Record

Status
Not open for further replies.

JSD1976

Programmer
Aug 17, 2004
16
US
Hello

I habe been working with VB6 for about four years, and have recently started working with VB6. I have linked VB6 to an MS Access database through a DataDataEnvironment. connection. I have a key value 'part number' with 3 other associated fields on my form in VB6. I also have cheesy 'Next Record' and 'Previous Record' buttons on my form. What I'm looking to do is prompt an Input Box with a command button, enter the key value, and return the record with the other fields' info respectively. I have tried to do this, but with no succes. I have also tried building an SQL statement with a WHERE clause that prompts a parameter in the DataEnvironment command that links to my databse, as I would in Access. That did not work. I feel like I'm back at square one. Can someone help me find a record with an Input Box? Thanks a million for your expertise.

Jeremy
 
Why use an input box? just develop a form that works like an input box but runs the Sql String to return your recordset.

 
Dim SQLStatement As String
SQLStatement = "SELECT * FROM YourTable WHERE ID= " & InputBox("Please provide the ID of the record", "Info neaded:")

Then execute your string. That's all.

Hope I've been helpful,
Bogdan Muresan.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top