Solved

Wait Until Shell Finishes

Posted on 2013-01-12
3
842 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
3 Comments
 
LVL 39

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 119

Accepted Solution

by:
Rey Obrero 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Contents of subform based upon combobox value 3 26
Storing Combo Box Selection in Table 12 44
how to link subforms ms/access VBA 6 30
Access Excel export not behaving 2 25
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
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…

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now