MS Access, VBA, GetSignal - how?

MS Access, VBA, GetSignal - how?

Postby bbetts » Thu Jan 15, 2009 11:37 pm

Simple question from a newbie:
How to listen for S8 signal in MS Access?

No problem doing so in Excel vba based on examples.

I am guessing I am missing a bit of VL code that sends the signal somewhere. In S8 all I have is a WI label called sigTest that has the Ask VB radio button clicked.

Sorry for the bother, but there are no VBA examples that I can find other than relating to Excel. (VB - not of any use to me.) .

See code below.

Thanks in advance!
Bruce

Option Compare Database
'*********************************************
'Sub sigTest is where I am trying to listen for a signal.
'I assume that once I understand how the listening is done, then I will understand sending back to S8 as well.
'*************************************************

Private WithEvents MYSIMUL8 As SIMUL8.S8Simulation
Private WithEvents S8 As SIMUL8.S8SimObject ' not sure if I need this at this point, still scanning and learning about S8 objects.

'(I have also cut and pasted the Simul8 Library module
from the excel examples.)


Private Sub Command0_Click()
'open S8 from Access
Set MYSIMUL8 = GetObject("", "SIMUL8.S8Simulation")
End Sub

Private Sub Command1_Click()
'Open and run S8 simulation file
MYSIMUL8.Open "c:\myFile\MyS8test.s8"
MYSIMUL8.RunSim 2400
End Sub

Private Sub Command2_Click()
Set MYSIMUL8 = Nothing
End Sub

Sub sigTest()
Dim Signal As String
Signal = S8.GetSignal() 'Get full text of signal
Debug.Print Signal 'just to view if you want to see it
Debug.Print test
Select Case Signal
Case "First Case"
'Do something here
Case "Second Case"
'Do something here
Case Else
'else do this'
End Select
S8_Signal_Done 'Tell SIMUL8 your code is compl[/color]ete
End Sub
InterMain Consulting Inc.
5334 2nd Ave
Delta B.C.
V4M 1E5

Return to “SIMUL8 Cafe”