I have a module in Excel that I would like to move to Access, but I'm not sure how to go about doing it. The module loops through the data stored on a certain sheet and enters the information in another system, called Extra. The module enters thirteen lines of data, presses Enter, and continues in that loop until all the data on the sheet has been entered. Once it is moved to Access, I would like it to loop through the results of a query instead of the data on a certain sheet. Here is the code that I have in Excel:
Can this code be modified to run through Access instead? Any help you can provide would be greatly appreciated. I've just spent about 40 hours building a new database to automate a process just to find out that the people won't use it unless it can run this module. :banghead:
Code:
Option Base 1
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub EnterCount()
Dim strSendKeys As String
Dim n As Integer
Dim Line As String
Dim Data(13) As Integer
Dim i As Integer
Dim varNumber As Double
Dim System As Object
Dim Sess0 As Object
Set WshShell = CreateObject("WScript.Shell")
Set System = CreateObject("EXTRA.System")
Set Sess0 = System.ActiveSession
SessName0$ = "Session1.EDP"
If Not Sess0.Visible Then Sess0.Visible = True
Do
For i = 1 To 13
Data(i) = Selection.Value
Selection.Offset(1, 0).Select
Next
For i = 1 To 13
Sess0.Screen.SendKeys ("<EraseEOF>")
Sess0.Screen.SendKeys (Data(i))
Sess0.Screen.SendKeys ("<TAB>")
Next
Sess0.Screen.SendKeys ("<ENTER>")
Sess0.Screen.WaitHostQuiet (2000)
Sleep (3000)
Loop Until IsEmpty(ActiveCell.Offset(1, 0))
End Sub
Can this code be modified to run through Access instead? Any help you can provide would be greatly appreciated. I've just spent about 40 hours building a new database to automate a process just to find out that the people won't use it unless it can run this module. :banghead: