Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Wait Until Shell Finishes

Posted on 2013-01-12
3
Medium Priority
?
1,004 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 2000 total points
ID: 38770094
0
 
LVL 31

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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

604 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