Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #16  
Old August 23rd, 2005, 12:42 AM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 57 m 26 sec
Reputation Power: 181
Did you add a reference to the MSComm object? AFAIK it's not included in Access VBA, but it is in VB6.

There are some 3rd party Com port controls available too, but I don't know of any free ones.
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
  #17  
Old August 23rd, 2005, 12:35 PM
Jaykappy Jaykappy is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Feb 2005
Posts: 743 Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 9 h 45 m 27 sec
Reputation Power: 23
Do you mean adding a Reference Object from the Access Reference Library?

If so which one?

Can you explain a bit further?

Thanks for your help

Reply With Quote
  #18  
Old August 23rd, 2005, 12:52 PM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,186 nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 Days 7 h 36 m 24 sec
Reputation Power: 699
hi Jay,

add the Microsoft Comm Control 6.0 to the project.
__________________
Look! Its a ShemZilla



Reply With Quote
  #19  
Old August 25th, 2005, 10:35 AM
Jaykappy Jaykappy is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Feb 2005
Posts: 743 Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 9 h 45 m 27 sec
Reputation Power: 23
Wow that was a task.....I could not find it in Access....went on line and found the MSComm32.ocx control and added it to my project. It took a bit but finally got it in there.

I then ran my code and had an issue because I was calling it MSComm1. I went to the properties and it was named MSComm6. I used that and a bunch of my coding problems vanished. Although the most important still exists. It is not grabbing the NMEA String. I am trying to push it to a msxbox and to a text box.

I get the message "NO DEAL"
I dont get the Message "ENTERING CASE STATEMENT"

So this is telling me a few things, I think:
1. I am getting into the Case Statement
2. It is not finding $GPGGA so goes to the Case Else statement and returns in a msxbox "NO DEAL"

Do you have any thoughts as to why its not grabbing the string.
Is it perhaps reading the comm port and at that instance the GPGGA string is not there? THere are a bunch of Strigns beign passed to the port. Do I have to tell it to wait till the GPGGA strign appears?


CODE:

Option Compare Database

Private Sub Form_Load()

If (Not MSComm6.PortOpen) Then

' Buffer to hold input string
Dim Instring As String
' Use COM1.
MSComm6.CommPort = 1
' 9600 baud, no parity, 8 data, and 1 stop bit.
MSComm6.Settings = "9600,N,8,1"
' Tell the control to read entire buffer when Input is used.
MSComm6.InputLen = 0
' Open the port.
MSComm6.PortOpen = True
' Send the attention command to the modem.
MSComm6.Output = "AT" & vbCr ' Ensure that the modem responds with "OK".
' Wait for data to come back to the serial port.
Buffer$ = Buffer$ & MSComm6.Input



MsgBox "SMS Port Open", vbOKOnly, "Port State"
Else
MsgBox "SMS Port Already Open", vbOKOnly, "Port State"
End If

MsgBox "End Form Load"

Call MSComm6_OnComm

End Sub

'________________________________________________

Private Sub MSComm6_OnComm()

MsgBox "Enter Return Code"

'Attempting to Return a value from the port

Select Case MSComm6.CommEvent

Case "$GPGGA"

MsgBox "ENTERING CASE STATEMENT"

'writing the return to the buffer variable from the Comm Port
Buffer = MSComm6.Input
If InStr(Buffer, "$GPGGA") > 0 Then
' Converting the return so I can read it

MsgBox StrConv(Buffer, vbUnicode)
TEXTBOX.Text = MSComm6.Input

End If

Case Else
MsgBox "NO DEAL"

End Select


End Sub

Reply With Quote
  #20  
Old August 25th, 2005, 11:01 AM
Jaykappy Jaykappy is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Feb 2005
Posts: 743 Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 9 h 45 m 27 sec
Reputation Power: 23
ALRIGHT HERES THE DEAL: I got it to start returning NMEA Strings....For some reason its returning all of them.....and on top of that I placed the code in the "Case Else". I dont know why the Case "$GPGGA" is not working....

What I am looking for is how to Buffer the numerous strings down to just the $GPGGA strings and then further by the newest $GPGGA string.

ANY THOUGHTS?


Private Sub MSComm6_OnComm()

MsgBox "Enter Return Code"
'Attempting to Return a value from the port

Select Case MSComm6.CommEvent

Case "$GPGGA"

MsgBox "ENTERING CASE STATEMENT"
'writing the return to the buffer variable from the Comm Port Buffer = MSComm6.Input
If InStr(Buffer, "$GPGGA") > 0 Then
' Converting the return so I can read it
MsgBox StrConv(Buffer, vbUnicode)
TEXTBOX.Text = MSComm6.Input

End If

Case Else
Dim NMEAString As String
NMEAString = MSComm6.Input

If InStr(NMEAString, "$GPGGA") > 0 Then
' Converting the return so I can read it

MsgBox NMEAString

'MsgBox StrConv(NMEAString, vbUnicode)
'TEXTBOX.Text = NMEAString
'MsgBox "NO DEAL"


End If
End Select


End Sub

Reply With Quote
  #21  
Old August 26th, 2005, 06:29 AM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,186 nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 Days 7 h 36 m 24 sec
Reputation Power: 699
Hi Jay,
you are mixing the string up with the event, you have
to use the event in the case function and then only check for the input string.
try using this:
Code:
Select Case MSComm6.CommEvent
            Case comEvReceive
                Buffer = MSComm6.Input
                  If InStr(Buffer, "$GPGGA") > 0 Then 'check to see if the command has $GPGGA  in front
		      TEXTBOX.Text = strConv(Buffer, vbUnicode)
                  End If
            Case Else
               MsgBox "NO DEAL"
End Select

hope this helps

Reply With Quote
  #22  
Old August 26th, 2005, 09:28 AM
Jaykappy Jaykappy is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Feb 2005
Posts: 743 Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 9 h 45 m 27 sec
Reputation Power: 23
To Make things easier I placed all the code under an OnClick button. I can do this right? I wrote a bit of code IN BLUE to try adn figure this out.

If I run the code with the Blue active and the Red commented out I get a return of all teh strings.

If I run the code with the Blue commented out and the Red active it passes the first case statement and give me a message box NO DEAL.

I am confused here....For some reason it cannot find the String $GPGGA...ALSO below is the Message beign sent to the Text Box....

I thank you so much for your help here....I am really confused why I cannot filter down teh string/message.

CODE:

Option Compare Database

Private Sub Command8_Click()

MSComm6.InBufferCount = 0
'Flush the Comm Port

If (Not MSComm6.PortOpen) Then

Dim Instring As String
MSComm6.CommPort = 1
MSComm6.Settings = "9600,N,8,1"
MSComm6.InputLen = 0
MSComm6.PortOpen = True
MSComm6.Output = "AT" & vbCr ' Ensure that the modem responds with "OK".
Buffer$ = Buffer$ & MSComm6.Input

MsgBox "SMS Port Open", vbOKOnly, "Port State"
Else
MsgBox "SMS Port Already Open", vbOKOnly, "Port State"
End If



' Dim NMEAString1 As String
' Forms!GPS_RETRIEVE!TEXTBOX.SetFocus

'MSComm6.InBufferCount = 0

' NMEAString1 = MSComm6.Input
' If InStr(NMEAString1, "$GPGGA") > 0 Then
' ' Converting the return so I can read it
' TEXTBOX.Text = NMEAString1
' End If



Select Case MSComm6.CommEvent

Case comEvReceive
Buffer = MSComm6.Input
If InStr(Buffer, "$GPGGA") > 0 Then 'See if it has GPGGA in front
TEXTBOX.Text = StrConv(Buffer, vbUnicode)
'MsgBox StrConv(Buffer, vbUnicode)
End If
Case Else
MsgBox "NO DEAL"
End Select


End Sub




NMEA STRING/MESSAGE

$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGSV,3,1,10,01,09,235,00,03,14,262,00,05,00,114, 00,09,44,075,00*7C
$GPGSV,3,2,10,14,43,239,00,15,58,179,00,18,59,082, 00,19,19,294,00*75
$GPGSV,3,3,10,21,24,157,00,22,74,329,00,,,,,,,,*75
$PGRME,,M,,M,,M*00
$GPGLL,,,,,132526,*51
$PGRMZ,,,*7E
$PGRMM,NAD83*29
$GPBOD,,T,,M,,*47
$GPRTE,1,1,c,0*07
$GPRMC,132527,V,,,,,,,260805,,*38
$GPRMB,V,,,,,,,,,,,,V*66
$GPGGA,132527,,,,,0,00,,,M,,M,,*66
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGSV,3,1,10,01,09,235,00,03,14,262,00,05,00,114, 00,09,44,075,00*7C
$GPGSV,3,2,10,14,43,239,00,15,58,179,00,18,59,082, 00,19,19,294,00*75
$GPGSV,3,3,10,21,24,157,00,22,74,329,00,

Reply With Quote
  #23  
Old August 26th, 2005, 09:34 AM
Jaykappy Jaykappy is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Feb 2005
Posts: 743 Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 9 h 45 m 27 sec
Reputation Power: 23
Was looking further at my code and it appears that the

Case comEvReceive = 2 .....Does that mean its pinting to Com Port 2? THerefore I would not see the String.....Does that make sence?

Reply With Quote
  #24  
Old August 26th, 2005, 09:43 AM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,186 nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 Days 7 h 36 m 24 sec
Reputation Power: 699
Hi,
the code in red needs to be in the onComm event, because
that will get triggered when a input from the unit comes through.

the on_click will just get everything lying in the buffer of the unit
that is why you are getting all the values.

leave all the code as you have it, remove the red part and put
it in the onComm event.

Then click on the button so that the port is opened, and then send
something to the unit and see if the onComm fires

also change the code in red slightly, so that you can see if it goes
into the select, try this in the oncomm event
Code:
Select Case MSComm6.CommEvent

Case comEvReceive
	msgbox "Input Received"
	Buffer = MSComm6.Input
		If InStr(Buffer, "$GPGGA") > 0 Then 'See if it has GPGGA in front
			TEXTBOX.Text = StrConv(Buffer, vbUnicode)
			'MsgBox StrConv(Buffer, vbUnicode)
		End If
Case Else
	MsgBox "NO DEAL"
End Select

hope this helps

Reply With Quote
  #25  
Old August 26th, 2005, 09:57 AM
Jaykappy Jaykappy is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Feb 2005
Posts: 743 Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 9 h 45 m 27 sec
Reputation Power: 23
NoFriends....I THANK YOU SO MUCH FOR YOUR HELP HERE......

This is really driving me crazy here....THis is exacty what I have....and for some reason it will not go into the first Case Statement. It does not return the message box "Input Received". Although it does return the NO DEAL message which is in the Case Else Statement...So that tells me it is not seeing the $GPGGS statement. But i know its there. I can return the message with the Blue Code below.

I am not running into an issue because I am calling the OnComm event am I? "Call MSComm6_OnComm"


Option Compare Database

Private Sub Command8_Click()

If (Not MSComm6.PortOpen) Then

Dim Instring As String
MSComm6.CommPort = 1
MSComm6.Settings = "9600,N,8,1"
MSComm6.InputLen = 0
MSComm6.PortOpen = True
MSComm6.Output = "AT" & vbCr ' Ensure that the modem responds with "OK".
Buffer$ = Buffer$ & MSComm6.Input

MsgBox "SMS Port Open", vbOKOnly, "Port State"
Else
MsgBox "SMS Port Already Open", vbOKOnly, "Port State"
End If

MsgBox "End OnClick Load"

Call MSComm6_OnComm

End Sub




Public Sub MSComm6_OnComm()

Select Case MSComm6.CommEvent

Case comEvReceive
MsgBox "Input Received"
Buffer = MSComm6.Input
If InStr(Buffer, "$GPGGA") > 0 Then 'See if it has GPGGA in front
TEXTBOX.Text = StrConv(Buffer, vbUnicode)
MsgBox StrConv(Buffer, vbUnicode)
End If
Case Else
MsgBox "NO DEAL"
End Select

End Sub



OTHER CODE:
' Dim NMEAString1 As String
' Forms!GPS_RETRIEVE!TEXTBOX.SetFocus

'MSComm6.InBufferCount = 0

' NMEAString1 = MSComm6.Input
' If InStr(NMEAString1, "$GPGGA") > 0 Then
' ' Converting the return so I can read it
' TEXTBOX.Text = NMEAString1
' End If

Reply With Quote
  #26  
Old August 26th, 2005, 10:11 AM
Jaykappy Jaykappy is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Feb 2005
Posts: 743 Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 9 h 45 m 27 sec
Reputation Power: 23
I took the Call to the CommEvent out and It still gives me the NO DEAL message box. Which tells me it got into the Select statement but it went to the second case statement bypassing the first....it dosent even get into the first....because the MsgBox "Input Received" is not being returned....

I am dumbfounded here....I thank you all for your help....As I am new to this......but excited because I am learngin a lot here.....

Reply With Quote
  #27  
Old August 26th, 2005, 10:27 AM
Jaykappy Jaykappy is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Feb 2005
Posts: 743 Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 9 h 45 m 27 sec
Reputation Power: 23
When I debug my code I see that the

Case comEvReceive = 2

what does that mean?

Reply With Quote
  #28  
Old August 26th, 2005, 10:38 AM