p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Pro VB Databases (http://p2p.wrox.com/forumdisplay.php?f=81)
-   -   OTHER: Pass query result to a Form (http://p2p.wrox.com/showthread.php?t=40581)

sugar March 30th, 2006 05:01 PM

OTHER: Pass query result to a Form
 
Hi, i make a code fully based on this this topic: http://p2p.wrox.com/topic.asp?TOPIC_ID=31077 It call and execute a .bat file, afther that it should run an sql query, pass the result as a variable and print it in the MsgBox myY, but it doesnt do it... what im missing?

Code:

Private Sub CmdRMSfile_Click()

Dim strCmd As String
Dim ds As Database
Dim dds As Recordset
Dim myY
Dim k As DAO.QueryDef

strCmd = """C:\xml2odbc\po.bat"""
Shell strCmd

Set ds = OpenDatabase("C:\OM-TEST\StoneEdge\SEOrdMan2002.mdb")
k = "select MAX(OrderNumber) from [Orders];"
Set dds = ds.OpenRecordset(k)
myY = dds!kk
MsgBox myY
ds.Close

End Sub

thanks in advance

sugar March 30th, 2006 07:48 PM

got it... i miss a "select MAX(OrderNumber) as [kk] from [Orders];" in the sql... query
Other question... how can I have the sql query to wait until the "Shell strCmd" is done in order to be executed...?


peko April 3rd, 2006 03:47 AM

Hi,
For wait until the Shell is done use API WaitForSingleObject
Peko


sugar April 4th, 2006 11:14 AM

thanks!



All times are GMT -4. The time now is 06:49 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.