Auto Records
กระทู้เก่าบอร์ด อ.สุภาพ ไชยา

 259   1
URL.หัวข้อ / URL
Auto Records

ถามไว้ที่ 
http://www.utteraccess.com/forums/showflat.php?Cat=&Board=AxxessXP&Number=108211&Forum=CatSearch-2&Words=TimK&Match=Username&Searchpage=0&Limit=25&Old=allposts&Main=108203&Search=true#Post108211 
 
ดังนี้ 
I need to save a time in entering data to table. 
I have Serial Starting From and Serial Ending.  
Is there any way to do it by entering the Start From and End To than the function  
do it for me as an example if I have 345100 to 345200 the QTY is 200 Serials. 
If I enter the start it should entering in the other filed which called CONTROL  
 
Like this  
345100 
345101 
and so ..to 345200 
 
Any help will be greatly appreciated. Thank you. 
  
hopeful  
 
ผมตอบไป โดยให้เขาใช้โค้ดดังนี้ครับ 
 
Private Sub cmdAdd_Click() 
Dim rst As Recordset, I As Integer 
 
If (Me.txtStart = "" Or IsNull(Me.txtStart)) Or _ 
(Me.txtEnd = "" Or IsNull(Me.txtEnd)) Then 
    MsgBox "You have to fill in blah, blah, ...", vbOKOnly 
    Me.txtStart.SetFocus 
Exit Sub 
Else 
Set rst = Me.RecordsetClone 
For I = 0 To (Me.txtEnd - Me.txtStart) 
   rst.AddNew 
     rst("Control") = Me.txtStart + I 
   rst.Update 
Next I 
Me.Requery 
rst.Close 
End If 
 
End Sub 
 
ที่ลิ้งค์ข้างบนมีไฟล์ตัวอย่างด้วยครับ ลองไปเอามาดู แล้วเปลี่ยนโค้ดตามที่ผมแนะนำเขาไว้ด้วย

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

1 @R00577
ไป save เก็บ code ไว้แล้วค่ะ ขอบพระคุณค่ะ สองอาทิตย์ที่ผ่านมา วันนี้พึ่งจะเข้า web ได้
@ ประกาศใช้งานเว็บบอร์ดใหม่ => บอร์ดเรียนรู้ Access สำหรับคนไทย
แล้วจะใส่ลิ้งอ้างอิงมาที่โพสต์เก่านี้หรือไม่ก็ตามสะดวกครับ
Time: 0.0545s