cuongvan09 > 25-06-12, 11:32 AM
(25-06-12, 11:10 AM)khanhduycsgt Đã viết: Code trong Frame9
Mã:Private Sub Frame9_BeforeUpdate(Cancel As Integer)
If Me.Frame9 = 1 Then 'Neu Frame9 chon radio button thu 1 thi khoa 2 textbox Tungay va Denngay
Me.Tungay.Enabled = False
Me.Denngay.Enabled = False
Else 'Nguoc lai thi mo khoa
Me.Tungay.Enabled = True
Me.Denngay.Enabled = True
End If
End Sub
Code trong form_load
Mã:Private Sub Form_Load()
'Ngay khi mo form thi 2 textbox nay se bi khoa, vi mac dinh Frame9 chon la 1
Me.Tungay.Enabled = False
Me.Denngay.Enabled = False
End Sub
khanhduycsgt > 25-06-12, 12:04 PM
Option Compare Database
Dim chuoi As String
Dim chuoi2 As String
Dim i As Integer
Private Sub Command6_Click()
On Error GoTo Err_Command6_Click
DoCmd.Close
DoCmd.OpenForm "frmmain"
Exit_Command6_Click:
Exit Sub
Err_Command6_Click:
MsgBox Err.Description
Resume Exit_Command6_Click
End Sub
Private Sub Form_Timer()
Select Case i
Case 1, 4, 7, 10, 13, 16, 19, 22, 25
Me.Label57.Caption = Left(chuoi, i) & " /"
Case 2, 5, 8, 11, 14, 17, 20, 23, 26
Me.Label57.Caption = Left(chuoi, i) & " --"
Case Else
Me.Label57.Caption = Left(chuoi, i) & " \"
End Select
i = i + 1
If i > Len(chuoi) Then
i = 1
End If
End Sub
Private Sub Form_Load()
chuoi = Me.Caption
Me.Tungay.Enabled = False
Me.Denngay.Enabled = False
End Sub
Private Sub Frame9_BeforeUpdate(Cancel As Integer)
If Me.Frame9 = 1 Then
Me.Tungay.Enabled = False
Me.Denngay.Enabled = False
Else
Me.Tungay.Enabled = True
Me.Denngay.Enabled = True
End If
End Sub
cuongvan09 > 25-06-12, 12:11 PM
(25-06-12, 12:04 PM)khanhduycsgt Đã viết: Đây là toàn bộ code form F_baocaonhap mà mình đã sửa:
Mã:Option Compare Database
Dim chuoi As String
Dim chuoi2 As String
Dim i As Integer
Private Sub Command6_Click()
On Error GoTo Err_Command6_Click
DoCmd.Close
DoCmd.OpenForm "frmmain"
Exit_Command6_Click:
Exit Sub
Err_Command6_Click:
MsgBox Err.Description
Resume Exit_Command6_Click
End Sub
Private Sub Form_Timer()
Select Case i
Case 1, 4, 7, 10, 13, 16, 19, 22, 25
Me.Label57.Caption = Left(chuoi, i) & " /"
Case 2, 5, 8, 11, 14, 17, 20, 23, 26
Me.Label57.Caption = Left(chuoi, i) & " --"
Case Else
Me.Label57.Caption = Left(chuoi, i) & " \"
End Select
i = i + 1
If i > Len(chuoi) Then
i = 1
End If
End Sub
Private Sub Form_Load()
chuoi = Me.Caption
Me.Tungay.Enabled = False
Me.Denngay.Enabled = False
End Sub
Private Sub Frame9_BeforeUpdate(Cancel As Integer)
If Me.Frame9 = 1 Then
Me.Tungay.Enabled = False
Me.Denngay.Enabled = False
Else
Me.Tungay.Enabled = True
Me.Denngay.Enabled = True
End If
End Sub