Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB Databases
| Search | Today's Posts | Mark Forums Read
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old March 30th, 2006, 05:01 PM
Authorized User
 
Join Date: Mar 2006
Location: Calexico, CA, USA.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
  #2 (permalink)  
Old March 30th, 2006, 07:48 PM
Authorized User
 
Join Date: Mar 2006
Location: Calexico, CA, USA.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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...?

  #3 (permalink)  
Old April 3rd, 2006, 03:47 AM
Authorized User
 
Join Date: Mar 2006
Location: Bratislava, , Slovakia.
Posts: 80
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

  #4 (permalink)  
Old April 4th, 2006, 11:14 AM
Authorized User
 
Join Date: Mar 2006
Location: Calexico, CA, USA.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks!



Similar Threads
Thread Thread Starter Forum Replies Last Post
pass the result of a query to a variable ... eusebio Pro VB Databases 6 March 30th, 2006 07:41 PM
Show result from query akibaMaila VB.NET 2002/2003 Basics 2 January 18th, 2005 12:43 PM
Unexpected result from the query tsimsha Classic ASP Databases 1 August 23rd, 2004 03:50 AM
Query Result mateenmohd SQL Server 2000 0 November 1st, 2003 03:53 AM
Archiving query result Ned SQL Server 2000 5 October 8th, 2003 03:34 PM





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