Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 QA in Access Data Project

Author  Topic 

Doug G
Constraint Violating Yak Guru

331 Posts

Posted - 2002-03-11 : 20:47:10
Is there anything like a Query Analyzer window in an Access Data Project? I haven't been able to find a spot to write an ad-hoc query within an adp.

Thanks,

======
Doug G
======

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2002-03-11 : 21:19:49
quote:

Is there anything like a Query Analyzer window in an Access Data Project?


What about creating your own?
Create a form
Create a textbox on the form called txtSQL, multiline etc
Create a textbox called txtOut, multiline etc
Create a button called cmdRun

And then something like:

Public Sub cmdRun_Click()
Dim cnxn as New ADODB.Connection
Dim rst as New ADODB.Recordset
Dim fld as Field
Dim sOUT as String

cnxn.Open gsProvider
rst.Open txtSQL.Text, cnxn

If NOT (rst is nothing) then
IF NOT rst.EOF then
'Column Heads
For each fld in rst.Fields
sOut = sOut & fld.Name & chr(9)
Next

'Data
Do While NOT rst.EOF
For each fld in rst.Fields
sOut = sOut & Cstr(rst.Fields(fld.Name)) & chr(9)
Next
rst.moveNext
sOut = sOut & vbcrlf
Loop
End if
End if
txtOut.Text = sout
Me.repaint

Set rst= nothing
Set cnxn = nothing

End Sub


Of course, that's just a hack to get going - so how about when you're done, posting back the finished code? Thanks - I'd love it.

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"

Edited by - rrb on 03/11/2002 21:21:38
Go to Top of Page
   

- Advertisement -