serial port programming

serial data into access data base using VB 6.0

Page 1 of 1

6 Replies - 15092 Views - Last Post: 27 March 2008 - 11:29 AM Rate Topic: -----

#1 apuamy  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 10
  • Joined: 24-February 08

serial port programming

Post icon  Posted 24 February 2008 - 05:00 AM

i want to get data coming from serial com port into an MS access data base.i am using VB 6.0 as front end and MS Access as back end.Can anybody help me.

This post has been edited by apuamy: 24 February 2008 - 05:20 AM

Is This A Good Question/Topic? 0
  • +

Replies To: serial port programming

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: serial port programming

Posted 24 February 2008 - 10:06 AM

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Post your code like this: :code:

Thanks :)

Just a small nudge, theres a control in VB6 that makes this much simpler than you would think, you're going to want to research the MSComm Control. This control will give you all the functionality you need for serial port communication.

Happy Coding! :)
Was This Post Helpful? 0
  • +
  • -

#3 EMMADDAI  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 15-November 06

Re: serial port programming

Posted 25 February 2008 - 01:15 PM

could you please add what u've bn able to do. so that we try taking it up from there? thanks
Was This Post Helpful? 0
  • +
  • -

#4 realwish  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 47
  • Joined: 29-January 08

Re: serial port programming

Posted 26 February 2008 - 09:49 PM

the same i am still finding
Was This Post Helpful? 0
  • +
  • -

#5 LookNAO  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 66
  • Joined: 28-December 07

Re: serial port programming

Posted 27 February 2008 - 11:22 AM

Load the MSComm control.

Now depending on what you are hooking up to it, you need to know the following:
Baud rate
parity
data bit
stop bit

It will look something like : 9600, n, 8, 1

When you load the MSComm control, it does not work "out of the box".

set the following:

MSComm1.RThreshold = 1
MSComm1.SThreshold = 1

Depending on the handshaking:
MSComm1.DTREnable = False


Good luck
Was This Post Helpful? 0
  • +
  • -

#6 apuamy  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 10
  • Joined: 24-February 08

Re: serial port programming

Posted 26 March 2008 - 11:56 AM

View PostLookNAO, on 27 Feb, 2008 - 11:22 AM, said:

Load the MSComm control.

Now depending on what you are hooking up to it, you need to know the following:
Baud rate
parity
data bit
stop bit

It will look something like : 9600, n, 8, 1

When you load the MSComm control, it does not work "out of the box".

set the following:

MSComm1.RThreshold = 1
MSComm1.SThreshold = 1

Depending on the handshaking:
MSComm1.DTREnable = False


Good luck


Thanks for the input
i am using baud rate, parity,databit and stop bit as 110,e,7,2.
no hand shaking
i am getting data in a text box, and can able to send out from a text box.
But now i have to send and store from a data base.
for sending i think this will work
x = Data1.Recordset.Fields("TTW Command")
MSComm2.Output = x

but for receiving data in a data base i am lost
I can still receive data line by line in a text box, but how can i store the same, serially in a data base under a field.
How this will affect
MSComm1.RThreshold = 1
MSComm1.SThreshold = 1
In my case both r 0.
my project involves connecting a computer with a RADAR for initiating certain command and getting results for its fault diagnostic.
Was This Post Helpful? 0
  • +
  • -

#7 apuamy  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 10
  • Joined: 24-February 08

Re: serial port programming

Posted 27 March 2008 - 11:29 AM

Hi there,
i am sending th entire codes of the form down below
Dim strInput As String
Dim ser As Long



Private Sub Command1_Click()
ser = 1

Text1.Enabled = False
Text5.Enabled = False

MSComm1.Output = Text2.Text
Text1.Enabled = True
Text5.Enabled = True
Text2.Text = ""


End Sub

Private Sub Command2_Click()

End Sub

Private Sub Form_Load()


MSComm1.PortOpen = True
With Text1
'set the properties for the displaying textbox
.BackColor = vbCyan
.Locked = True
.Text = ""
End With 'Text1
With Text2
'set the properties for the 'send' textbox
.TabIndex = 0
.Text = ""
End With 'Text2
With Command1
'set the properties for the 'send' command button
.Caption = "&Send"
.Default = True
.TabIndex = 1
End With 'Command1

End Sub

Private Sub Form_Resize()
Dim sngWidth As Single, sngHeight As Single
Dim sngDisplayHeight As Single
Dim sngTxtWidth As Single
Dim sngCmdWidth As Single, sngCmdHeight As Single
'calculate the inner size of the form
sngWidth = ScaleWidth
sngHeight = ScaleHeight
With Command1
'resize and reposition the command button
sngCmdHeight = .Height
sngCmdWidth = .Width
sngDisplayHeight = sngHeight - sngCmdHeight
sngTxtWidth = sngWidth - sngCmdWidth
.Move sngTxtWidth, sngDisplayHeight, sngCmdWidth, sngCmdHeight
End With 'Command1
'resize and reposition the label
Text1.Move 0, 0, sngWidth, sngDisplayHeight
'resize and reposition the textbox
Text2.Move 0, sngDisplayHeight, sngTxtWidth, sngCmdHeight

End Sub

Private Sub Timer1_Timer()

If (MSComm1.InBufferCount > 0) Then

strInput = MSComm1.Input
Text1.Text = Text1.Text + strInput
Text5.Text = Text5.Text + strInput

End If


'storing input data in a data base
Data2.RecordSource = "SELECT * FROM rxmsg WHERE SER=" & ser
Data2.Refresh
Data2.Recordset.Edit
Data2.Recordset.Fields("RXMSG") = Text5.Text
Data2.UpdateRecord
ser = ser + 1
Text5.Text = ""
End Sub

After loading the form, i hit on command button to send data.After this the device replies back and can be seen in text box1.now i am simultaneously put the same receive data in textbox 5. After that i am trying to transfer the data to a data base. After a line is received , i erase the textbox 5 and again go for the next line.
The error i am getting
1st on loading form- object doesnt support the property or method
2nd- Run time error '3021' No current record

I have a doubt the codes written in the timer1 in red colour
has to be written there or else where. On running the program cannot be stopped normally, but by task manager.
data base 2 concerned table has two field i.e SER and RXMSG. ser is being incremented to go to the particular record and fill.
Thanks for helping me.
Was This Post Helpful? 1

Page 1 of 1