---@--- สามารถ ทำปุ่มหน้า ฟอร์ม ของAccess ให้สั่งงานให้ลิ้นชักที่ต่ออยู่กับCOM2 เด้งออกมาได้มั๊ยครับ
กระทู้เก่าบอร์ด อ.สุภาพ ไชยา

 366   5
URL.หัวข้อ / URL
---@--- สามารถ ทำปุ่มหน้า ฟอร์ม ของAccess ให้สั่งงานให้ลิ้นชักที่ต่ออยู่กับCOM2 เด้งออกมาได้มั๊ยครับ

ขอถามหน่อยครับว่า  
คือผมใช้โปรแกรมAccessร่วมกับการใช้ลิ้นชักที่ต่อกับเครื่องคอมพิวเตอร์ ผ่านCom2  
และผมต้องการให้ลิ้นชัก สามารถเด้งออกมาได้เมื่อกดปุ่มที่หน้าฟอร์มaccess ควรใช้คำสั่งอะไรครับ  
ตอนนี้ใช้ ปุ่มทำ Link ไป Bat Fileที่ DOS อยู่ครับ >n แบบนี้อ่ะครับ  
ขอบคุณครับ

5 Reply in this Topic. Dispaly 1 pages and you are on page number 1

1 @R00447
ผมไม่เคยใช้คำสั่งผ่าน Com2 Port เลยนะครับ คงใช้คำสั่งเดิมไปก่อนนะครับ
2 @R00451
ผมได้ไปค้นที่เว็บของต่างประเทศ เขาบอกว่าให้ใช้ ActiveX ชื่อ Microsoft Communications Control (เมน Insert>ActiveX...) จากนั้นลองใช้โค้ดข้างล่างนี้กับปุ่ม Command Button ชื่อ cmdOpen แล้วใส่ Caption เป็น Open ดูนะครับ Private Sub cmdOpen_Click() If Not Me.MSComm0.PortOpen Then Me.MSComm0.PortOpen = True MsgBox "Open" Me.cmdOpen.Caption = "Close" Else Me.MSComm0.PortOpen = False MsgBox "Closed" Me.cmdOpen.Caption = "Open" End If End Sub ได้ผลอย่างไร แจ้งด้วยครับ ผมยังไม่เคยมีเครื่องฯ แบบนี้ครับ
3 @R00452
ถ้าต้องการที่จะศึกษาการตั้งค่าต่างๆ ของ MSComm Control ลองดูที่ http://www.yes-tele.com/mscomm.html ครับ ซึ่งในกรณีเปิดลิ้นชัก อาจจะต้องมีคำสั่งเพิ่มเติมอีก ส่วนตัวอย่างอีกอันหนึ่งที่ http://c85.cemi.rssi.ru/Access/TipDetail.idc?TipID=4 เป็นตัวอย่างที่ใช้หมุนโทรศัพท์ครับ หรือตัวอย่างการใช้เพื่ออ่านอุณหภูมิก็ได้ครับ ที่ http://www.rentron.com/ActiveX.htm
4 @R00454
ขอบคุณมากครับ เดี๋ยวผมลองดูก่อนนะครับ
5 @R00456
ตัวอย่างในการตรวจหาโมเด็มครับที่ http://pub13.ezboard.com/fvisualbasicexplorerinternetprogramming.showMessage?topicID=1359.topic และนี่คือส่วนหนึ่งของโค้ดที่เขาให้มาครับ this code checks which ports are existant and which have a modem connected you could change the place where i add the port to list2, so that it writes it to file or to the register 1 form 2 listboxes 1 command button 1 mscomm control Function CheckComPort(intPort As Integer) As Boolean Dim sngTime As Single Dim strData As String On Error Goto ErrorFound MSComm1.CommPort = intPort MSComm1.PortOpen = True sngTime = Timer + 1 'check comport for modem during 1 second MSComm1.Output = "AT" & vbCr Do While Timer < sngTime Doevents If MSComm1.InBufferCount Then strData = strData & MSComm1.Input If Instr(strData, "OK") Then List2.AddItem "Com" & Cstr(intPort) Exit Do End If End If Loop MSComm1.PortOpen = False CheckComPort = True Exit Function ErrorFound: Select Case Err.Number Case 8002 'port doesnt exist CheckComPort = False Case 8005 'already in use CheckComPort = False End Select End Function Private Sub Command1_Click() Dim intIndex As Integer For intIndex = 1 To 4 If CheckComPort(intIndex) Then List1.AddItem "Com" & Cstr(intIndex) End If Next intIndex End Sub
@ ประกาศใช้งานเว็บบอร์ดใหม่ => บอร์ดเรียนรู้ Access สำหรับคนไทย
แล้วจะใส่ลิ้งอ้างอิงมาที่โพสต์เก่านี้หรือไม่ก็ตามสะดวกครับ
Time: 0.0441s