¼¼Êõ µã
- ¼¼Êõ
- µã
- V±Ò
- µã
- »ý·Ö
- 21536
|
¾¹ýÁ½¸öÔµÄAccessѧϰ£¬¶Ô´°ÌåÉè¼ÆÖеÄһЩ³£Ó÷½·¨ÂÔÓÐÊÕ»ñ£¬ÏÖ½«Æ伯³ÉÔÚÒ»Æ𣬿ÉÄܶÔÆäËû³õѧÕßÓÐËù°ïÖú¡£
´°ÌåÖÐÖ÷Òª°üº¬ÁËÎı¾¿òµÄËø¶¨Óë½âËø£»°´Å¥µÄÒþ²ØÓëÏÔʾ£»×Ó´°ÌåµÄÒþ²ØÓëÏÔʾ£»ÐÐÁеÄÒþ²ØÓëÏÔʾ£»ÐÐÁеÄËø¶¨Óë½âËø£»¼Ç¼µÄ×Ô¶¯±àÂë¡¢ÐÂÔö¡¢É¾³ý£»Í³¼Æ×Ó´°ÌåÊý¾Ý£»×Ó´°Ìå¼Ç¼µÄÌõ¼þ¸ñʽ£»Ñ¹ËõÓëÐÞ¸´Êý¾Ý¿â£»×Ô¶¯ºê£»µÈÏà¹Ø¹¦ÄÜ¡£
»¶ÓAccessר¼ÒºÍ°®ºÃÕßÔö¼Ó¹¦ÄÜ£¬Îª¹ã´óAccess³õѧÕßÌṩʾ·¶¡£
1¡¢¼ÓÔØʱ£¬Ê¹ÓÃ×Ó´°Ìå1£¬Ñ§Éú±íÈ«²¿¼Ç¼£¬Ëø¶¨Ö÷´°ÌåºÍ×Ó´°Ìå¼Ç¼£¬ÅäÖð´Å¥¡£
Private Sub Form_Load()
Dim sql As String
Me.×Ó´°Ìå.SourceObject = "×Ó´°Ìå1"
sql = "select * from ѧÉú±í"
Me.°à¼¶ID.Locked = True
Me.°à¼¶Ãû³Æ.Locked = True
Me.×Ó´°Ìå.Form.RecordSource = sql
Me.×Ó´°Ìå.Form.AllowAdditions = False
Me.×Ó´°Ìå.Form.AllowDeletions = False
Me.×Ó´°Ìå.Form.AllowEdits = False
Me.Òþ²ØÁÐ.Visible = False
Me.Õ¹¿ªÁÐ.Visible = False
Me.Òþ²ØÐÐ.Visible = False
Me.Õ¹¿ªÐÐ.Visible = False
End Sub
2¡¢¹Ø±Õ´°Ìåʱ£¬Ñ¹Ëõ²¢ÐÞ¸´Êý¾Ý¿â¡£
Private Sub Form_Close()
'ѹËõºÍÐÞ¸´Êý¾Ý¿â
CommandBars("Tools").Controls("Êý¾Ý¿âʵÓù¤¾ß(&D)").Controls("ѹËõºÍÐÞ¸´Êý¾Ý¿â(&C)...").accDoDefaultAction
End Sub
3¡¢Ë«»÷°à¼¶ID»ò°à¼¶Ãû³Æʱ£¬½âËø¡£
Private Sub °à¼¶ID_DblClick(Cancel As Integer)
Me.°à¼¶ID.Locked = False
End Sub
Private Sub °à¼¶Ãû³Æ_DblClick(Cancel As Integer)
Me.°à¼¶Ãû³Æ.Locked = False
End Sub
4¡¢Ê§È¥½¹µãʱ£¬Ëø¶¨°à¼¶ID»ò°à¼¶Ãû³Æ¡£
Private Sub °à¼¶ID_LostFocus()
Me.°à¼¶ID.Locked = True
End Sub
Private Sub °à¼¶Ãû³Æ_LostFocus()
Me.°à¼¶Ãû³Æ.Locked = True
End Sub
5¡¢µ¥»÷ʱ£¬Ê¹ÓÃ×Ö´°Ìå1»ò×Ó´°Ìå2¡£
Private Sub ¸ü»»´°Ìå1_Click()
Me.×Ó´°Ìå.SourceObject = "×Ó´°Ìå1"
Me.Òþ²ØÁÐ.Visible = True
Me.Õ¹¿ªÁÐ.Visible = True
Me.Òþ²ØÐÐ.Visible = True
Me.Õ¹¿ªÐÐ.Visible = True
Me.ÐÂÔö.Visible = True
Me.ɾ³ý.Visible = True
End Sub
Private Sub ¸ü»»´°Ìå2_Click()
Me.×Ó´°Ìå.SourceObject = "×Ó´°Ìå2"
Me.Òþ²ØÁÐ.Visible = False
Me.Õ¹¿ªÁÐ.Visible = False
Me.Òþ²ØÐÐ.Visible = False
Me.Õ¹¿ªÐÐ.Visible = False
Me.ÐÂÔö.Visible = False
Me.ɾ³ý.Visible = False
End Sub
6¡¢µ¥»÷ʱ£¬ÏÔʾ»òÕßÒþ²Ø×Ó´°Ìå¡£
Private Sub Òþ²Ø´°Ìå_Click()
Me.×Ó´°Ìå.Visible = False
End Sub
Private Sub ÏÔʾ´°Ìå_Click()
Me.×Ó´°Ìå.Visible = True
End Sub
7¡¢µ¥»÷ʱ£¬ÏÔʾ»òÒþ²Ø°´Å¥¡£
Private Sub Òþ²Ø°´Å¥_Click()
Me.Òþ²ØÁÐ.Visible = False
Me.Õ¹¿ªÁÐ.Visible = False
Me.Òþ²ØÐÐ.Visible = False
Me.Õ¹¿ªÐÐ.Visible = False
End Sub
Private Sub ÏÔʾ°´Å¥_Click()
Me.Òþ²ØÁÐ.Visible = True
Me.Õ¹¿ªÁÐ.Visible = True
Me.Òþ²ØÐÐ.Visible = True
Me.Õ¹¿ªÐÐ.Visible = True
End Sub
8¡¢µ¥»÷ʱ£¬×Ô¶¯±àºÅ²¢ÐÂÔö¼Ç¼¡£
Private Sub ÐÂÔö_Click()
Dim sql As String
DoCmd.SetWarnings no
sql = "INSERT INTO ѧÉú±í ( °à¼¶ID, ѧÉúID ) "
sql = sql + "SELECT Right(Forms!Ö÷´°Ìå!°à¼¶ID,1) AS °à¼¶ID, IIf(Max([ѧÉúID]) Is Null,Forms!Ö÷´°Ìå!°à¼¶ID & '01',Format(Max([ѧÉúID])+1,'000')) AS ID "
sql = sql + "FROM ѧÉú±í WHERE ѧÉú±í.°à¼¶ID=Forms!Ö÷´°Ìå!°à¼¶ID;"
DoCmd.RunSQL sql
Me.×Ó´°Ìå.Requery
End Sub
9¡¢µ¥»÷ʱ£¬É¾³ýÖ¸¶¨¼Ç¼¡£
Private Sub ɾ³ý_Click()
DoCmd.SetWarnings no
DoCmd.RunSQL "DELETE * FROM ѧÉú±í WHERE ɾ³ý=Yes;"
Me.×Ó´°Ìå.Requery
End Sub
10¡¢µ¥»÷ʱ£¬Ëø¶¨¡¢½âËø¡¢Ë¢ÐÂ×Ó´°Ìå¡£
Private Sub Ëø¶¨_Click()
Me.×Ó´°Ìå.Form.AllowAdditions = False
Me.×Ó´°Ìå.Form.AllowDeletions = False
Me.×Ó´°Ìå.Form.AllowEdits = False
End Sub
Private Sub ½âËø_Click()
Me.×Ó´°Ìå.Form.AllowAdditions = True
Me.×Ó´°Ìå.Form.AllowDeletions = True
Me.×Ó´°Ìå.Form.AllowEdits = True
End Sub
Private Sub Ë¢ÐÂ_Click()
Me.×Ó´°Ìå.Requery
End Sub
11¡¢µ¥»÷ʱ£¬Òþ²Ø»òÕ¹¿ªÁС£
Private Sub Òþ²ØÁÐ_Click()
Me.×Ó´°Ìå.Form.¼Òͥסַ.ColumnHidden = True
Me.×Ó´°Ìå.Form.ÁªÏµµç»°.ColumnHidden = True
End Sub
Private Sub Õ¹¿ªÁÐ_Click()
Me.×Ó´°Ìå.Form.¼Òͥסַ.ColumnHidden = False
Me.×Ó´°Ìå.Form.ÁªÏµµç»°.ColumnHidden = False
End Sub
12¡¢µ¥»÷ʱ£¬Òþ²Ø»òÕ¹¿ªÐС£
Private Sub Òþ²ØÐÐ_Click()
Dim sql As String
sql = "select * from ѧÉú±í where isnull(ÐÕÃû)"
Me.×Ó´°Ìå.Form.RecordSource = sql
Me.×Ó´°Ìå.Requery
End Sub
Private Sub Õ¹¿ªÐÐ_Click()
Dim sql As String
sql = "select * from ѧÉú±í"
Me.×Ó´°Ìå.Form.RecordSource = sql
Me.×Ó´°Ìå.Requery
End Sub
[ ±¾Ìû×îºóÓÉ todaynew ÓÚ 2008-12-28 18:55 ±à¼ ] |
±¾Ìû×ÓÖаüº¬¸ü¶à×ÊÔ´
ÄúÐèÒª µÇ¼ ²Å¿ÉÒÔÏÂÔØ»ò²é¿´£¬Ã»ÓÐÕʺţ¿×¢²á
x
|