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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataEnvironment -- SQL Builder question

Status
Not open for further replies.

HebieBug

Programmer
Jan 8, 2001
354
JP
Have created a dataenviroment and the connection works fine. Have then set a command to it and then attempted to build a SQL statement.
Does anyone know how to set the criteria so that it looks at a forms Textbox ?
So if the textbox shows VIC then it will go through the database and then match with the corrasponding state. It will then display the matching field on a combo box. The diplaying part is fine. It's just the criteria
 
Hi!
Have you tried something like this: ?
dim mySql as string
mySql = "select myFeild1 from myTable where state = '" & txtState & "'"
...
Please tell me if its not what you wanted.

Irfan Ahmed.

 
Have already tried working it from an ADO angle but it does not seem to want to work (That's using the ADO statements with the dataenvrioment statements in the form).
If you know of a way of doing it using the dataenviroment and the ADO statement then please tell.
The reason why we need to use the dataenviroment is that the database is being moved to SQL at the end of the year. I'm also a little lazy and prfer just to change it in the dataenvrioment then going through all the foms and changing it there.
 
Figured out how to do for further reference
Dim arecord As New ADODB.Recordset
arecord.Open "Select * from TABLENAME WHERE FIELDNAME ='" & TEXTBOXNAME, DATAENVIRONMENT.CONNECTION, adOpenKeyset, adLockReadOnly
Irfan was on the right track it was just how to open the dataenvironment
 
With this you will have problems if you try to re run the query... see thread subject connection problems opened by myself..
Did'nt know it at the time but both of these logs are togeather
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top