Go To Blank Record in Form
กระทู้เก่าบอร์ด อ.สุภาพ ไชยา

 261   1
URL.หัวข้อ / URL
Go To Blank Record in Form

วันนี้มีคนถามเกี่ยวกับการใช้ FindFirst กันถึง 2 คน 
 
คนแรกที่ 
http://www.access-programmers.co.uk/forums/showthread.php?s=&threadid=32527 
 
เขาถามว่า 
I have used combo boxes for searching records with the FindFirst method  
before but today I can not get it to work. Maybe it is a Monday thing!?! I am  
searching the SSN field (no hyphens) which is formatted as a text field in the  
table. I keep getting the error message "Data Type Mismatch in criteria  
expression". Below is the code I have in the combo boxes AfterUpdate event...  
 
Me.RecordsetClone.FindFirst "[SocialSecurityNumber] = " & Me![cbSSNLookUp]  
Me.Bookmark = Me.RecordsetClone.Bookmark  
 
Can you spot what I am doing wrong? I have tried different ways to convert  
(ensure) everything to a text string but no luck.  
 
The combo box is bound to column 1 which is the SSN data. My row source is a  
TableQuery that is showing the SSN and Names fields and it is displaying data when queried.  
 
The SSN field in the table has to be formatted as text. I did not design this db for  
I would have it as a number.  
 
Thanks in advance for your help! 
 
 
__________________ 
ghudson 
 
สรุป เขาเคยใช้โค้ดที่เขาให้มาข้างบน ซึ่งเป็นการใช้ Combo Box ในการวิ่งไปยังข้อมูลที่ระบุนั้น ซึ่งเป็น 
ฟีลด์ Text แต่มันไม่ทำงานแล้ว จะทำอย่างไรดี 
 
ผมแนะนำให้เขาเพิ่มเครื่องหมาย ' เข้าไปดังนี้ 
Me.RecordsetClone.FindFirst "[SocialSecurityNumber] = ' " & Me![cbSSNLookUp] & "'" 
 
และอีกคำถามหนึ่งที่ 
http://www.access-programmers.co.uk/forums/showthread.php?s=&postid=106795#post106795 
 
Hello There  
 
Can anyone please tell me if when I'm in a form entering data say, in the first two  
records I exit out of the form and when I return I would like the cursor to jump to a  
control of my choice on the next blank record.  
 
I cannot do the method AcNewRecord as I have predefined records for  
example, my form/table is set out this way:  
 
No     Subject                     Date  
 
7001 My Subject              05/08/02  
7002 My Next Subject    05/08/02  
7003  
7004  
7005  
7006  
7007  
 
How do I say next time I enter this form the cursor should point me at the subject  
field on record 7003.  
 
Many Thanks 
 
สรุป จะให้วิ่งไปยังข้อมูลแรกที่มีฟีลด์ชื่อ Subject และ Date ว่างอยู่ จากตัวอย่างคือ 7003 
 
ก็ต้องใช้ FindFirst เข้าช่วยอีกแหล่ะครับ ดังนี้ 
 
Private Sub Form_Load() 
Me.RecordsetClone.FindFirst "Isnull([Subject]) And Isnull([MyDate])" 
Me.Bookmark = Me.RecordsetClone.Bookmark 
End Sub

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

1 @R06546
   
@ ประกาศใช้งานเว็บบอร์ดใหม่ => บอร์ดเรียนรู้ Access สำหรับคนไทย
แล้วจะใส่ลิ้งอ้างอิงมาที่โพสต์เก่านี้หรือไม่ก็ตามสะดวกครับ
Time: 0.0479s