แสดงกระทู้

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Nisar Malila

หน้า: [1]
1
ผมมี Textbox อยู่ 2 Textbox

Textbox  1 มี JPS64052271000002002321144130D08000 ต้องการโชว์แค่ 12 หลักหลัง

Textbox  2 มี JPS64052271000002744130D0800000232110 ต้องการโชว์แค่ 12 หลักตรงกลาง

จะต้องเขียนสูตร vba ยังไงครับ

1.BoundField
textbox bound กับ Field สามารถใส่โค้ดใน ControlSource ของ textbox ได้เลย โดยสมมุติ Field1 และ Field2 คือชื่อฟิลล์
ที่text1
=Right([Field1],12)

ที่text2
=Mid([Field2],18,12)

แบบที่2
ถ้าเป็นข้อมูลที่ผ่านการแสกนมาแล้วอยากตัดข้อความให้กำหนดตัวแปลมาเก็บค่าไว้เช่น
โค๊ด: [Select]
Dim strbarcode As String
strbarcode = Me.MyInput 'สมมุติว่ารับข้อมูลมาจาก textbox MyInput
Me.Text1 = Right(strbarcode, 12)
Me.Text2 = Mid([strbarcode], 18, 12)
โพสต์นี้ได้รับคำขอบคุณจาก: Nisar Malila

หน้า: [1]