Solved

Wait Until Shell Finishes

Posted on 2013-01-12
3
942 Views
Last Modified: 2013-05-03
I am trying to retrieve data about the network adapter into Access, to do this I first need to create a file with data generated by the ipconfig command

Shell "cmd /c ipconfig /all >C:\dev\ip.txt"

I then read the ip.txt file into MS Access and extract the data I need (the pysical ethernet address) The problem is that the program does not wait long enough for the shell command to create the file and it then generates an error as the file has not yet been created. If I run the program again without deleting the file ip.txt it all works fine.

Any suggestions on how to make the program wait until the file has been created would be appreciated.

John

Background
The reason I am doing this is to ensure that the program can only be run on a designated computer. There may be easier ways than using the physical address of the network adapter. Any suggestions as to alternative ways of achieving this would be good.
0
Comment
Question by:jhswinson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 40

Expert Comment

by:als315
ID: 38770078
May be will be enough to get, for example, MAC address:
http://www.ozgrid.com/forum/showthread.php?t=152338
In sample not declared variable GetNetworkConnectionMACAddress
Add line
Dim GetNetworkConnectionMACAddress As String
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 38770094
0
 
LVL 30

Expert Comment

by:hnasr
ID: 38770127
Try this:
Form1:
Private Sub Command2_Click()
    DoCmd.OpenForm "Form2", acNormal, , , , acDialog
    MsgBox ("BACK FROM DIALOG") ' this will wait untill you close Form2
    ' add your code to read the text file here.
End Sub

Form2:
Private Sub Command2_Click()
     Shell "cmd /c ipconfig /all >D:\ip.txt"
     ' you may use timer event to check for the existance of text file.
     'then dispose of Form2 to resume code in Form1
Exit Sub
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question