Questions about implementing a data connection

Galley

Board Regular
Joined
Nov 8, 2012
Messages
64
I am new to data connections, and while it is working, it's not behaving as I expected.

I have a form where the user enters an Order Number, and based on that value, I retrieve the Product Code, Lot Number and Product Description. I have established a data connection to an i5 server. I used the Micorsoft Query Wizard to generate the query. The query retireves the data based on the Order Number entered by the user.

Code:
Select MOMAST.ORDNO, MOMAST.FITEM, MOMAST.REFNO, MOMAST.FDESC
From GNPGVL.AMFLIBB.MOMAST MOMAST
Where (MOMAST.ORDNO=?)
Order by MOMAST.ORDNO

The problem is that the query runs as soon as they press the Enter key. I want them to have to click a command button, where I can prompt them if the data is correct. If not, I can clear the fields so they may retry.

The other problem is that the user is prompted for a username and password. I understand that I can run a query with VBA (including the User ID and password), but if I do that, do I need the existing data connection?
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
In your ODBC connection, you can set REMEMBER PASSWORD, and not have to keep entering it.
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,484
Members
448,967
Latest member
visheshkotha

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top