Forum: สอบถามปัญหา Notes ทางด้านพัฒนาโปรแกรม (Note Client) |
Tags1: | Created on Feb 26, 2008, 7:40 AM by fibkids/9Notes|Topic Responses: 17 |
&action=openDocument&documentId=1B72 |
ขอโทดค่ะ ไม่เข้าใจตรงนี้นะค่ะ
'ให้เก็บ last no อยู่ใน record ที่อาจจะเป็น profile document หรือเป็น record profile ธรรมดาก็ได้ คือสร้างยังไงค่ะ เป้นกำหนดทำในฟอร์มหรอค่ะ
ทำประมาณอย่างนี้หรือเปล่าค่ะ กำหนด ค่าไนฟอร์ม แล้วเก็บค่าในวิว หรือทำอีกแบบค่ะช่วยชี้แจงที :yellow_wink.gif:
[img]http://www.9notes.net/download.nsf/0/5EA0699E46F5D8AB472573FB00036B49/$file/RUNNUM_1.GIF[/img]
[img]http://www.9notes.net/download.nsf/0/5EA0699E46F5D8AB472573FB00036B49/$file/RUNNUM_2.GIF[/img]
แล้วกำหนดค่าในฟอร์ม ดังนี้
Sub Postopen(Source As Notesuidocument)
Dim ws As New notesuiworkspace
Dim uidoc As notesuidocument
Dim doc1,doc As notesdocument
Set uidoc = ws.currentdocument
Set doc = uidoc.document
Dim s As New notessession
Dim db As notesdatabase
Set db = s.currentdatabase
Set view = db.getview("RunNo")
Call view.Refresh
Dim run1 As Integer ' เป็น integer ก็พอ
docno=doc.begin(0)
Set doc1 = view.getdocumentbykey(docno)
On Error Goto errordoc 'เพื่อตรวจสอบว่า view เรา error หรือมีค่าอยู่ไหม
run1%=Cint(doc1.RunNo(0)) 'แปลงค่าเค้าซะหน่อยเพระ RunNo มันเป็น Text อยู่
doc.RunNo=run1%+1
Call uidoc.refresh 'form มันจะได้ refresh และรับค่า autonumber ที่เราเซ็ตให้
If uidoc.IsNewDoc Then
Call uidoc.save
End If
Exit Sub ' จบการทำงาน
errordoc:
doc.RunNo="1"
Call uidoc.refresh
Exit Sub
End Sub |
|