Beruflich Dokumente
Kultur Dokumente
Dim i As Integer
cmdControl(i).Enabled = Val(jcStr(i))
Next
End Sub
mBkMark = rsUsers.Bookmark
End If
'New Record, Just Blank the Text boxes and set the focus on the first text box
ClearControls
mNew = True
DimControls "0,0,0,1,1"
DimNav "0,0,0,0"
'Delete! Just Confirm this so that you don't accidentally delete info
With rsUsers
.Delete
.Requery
If EmptyDB(rsUsers) Then
Call ClearControls
mDirty = False
End If
LoadControls
Call cmdNavigate_Click(2)
End With
End If
End If
mDuplicate = True
DimControls "0,0,0,1,1"
DimNav "0,0,0,0"
Case 3 'Save
'Save.
'Record is edited
If EmptyDB(rsUsers) Then
LoadControls
Exit Sub
End If
strSQL = "UPDATE Users SET UserName = '" & txtUserName.Text & "', Pwd = '" & txtPwd.Text & "'"
_
End If
cnAP.Execute strSQL
rsUsers.Requery
mDuplicate = False
mNew = False
mDirty = False
DimControls "1,1,1,0,0"
DimNavX '
Me.Caption = "DB Tester (" & rsUsers.AbsolutePosition & " of " & rsUsers.RecordCount & ")"
Case 4 'Abandon
rsUsers.Bookmark = mBkMark
End If
LoadControls
mDuplicate = False
mNew = False
mDirty = False
End Select
mBkMark = -1
End Sub
'This procedure clears the text boxes so that the user can type in new info
txtUserName.Text = vbNullString
txtPwd.Text = vbNullString
End Sub
With rsUsers
If EmptyDB(rsUsers) Then
DimNavX
Exit Sub
End If
Case 0
.MoveFirst
Case 1 'Previous
.MovePrevious
If .BOF Then
.MoveFirst
End If
Case 2 'Next
.MoveNext
If .EOF Then
.MoveLast
End If
Case 3 'Last
.MoveLast
End Select
'Me.Caption = "DB Tester (" & .AbsolutePosition & " of " & .RecordCount & ")"
End With
mMove = True
LoadControls
End Sub
'Same as dimcontrol
Dim i As Integer
cmdNavigate(i).Enabled = Val(jcStr(i))
Next
End Sub
rsUsers.CursorLocation = adUseClient
"Uid=admin;" & _
"Pwd="
cnAP.CursorLocation = adUseClient
LoadControls
'Call the procedure to read data from recordset and display it in text boxes
Me.Caption = "DB Tester (" & rsUsers.AbsolutePosition & " of " & rsUsers.RecordCount & ")"
'Display the position and the total number of records in the Title Window
bBookMarkable = IIf(rsUsers.Supports(adBookmark), True, False)
'our recordset supports it, and if it does, then set bBookMarkable to True
'We are using iif function here aswell (this has nothing to do with ADO though!)
' Else
' End If
End Sub
With rsUsers
DimNavX '"0,0,0,0"
End If
If EmptyDB(rsUsers) Then
DimControls "1,0,0,0,0"
Exit Sub
End If
If .BOF Then
.MoveFirst
End If
If .EOF Then
.MoveLast
End If
'This is the place where we read the information from recordset '
End With
'The information is just displayed on the form and hence nothing is changed,
DimNavX
DimControls "1,1,1,0,0"
'We check this variable when we unload the form to determine whether
mDirty = False
Me.Caption = "DB Tester (" & rsUsers.AbsolutePosition & " of " & rsUsers.RecordCount & ")"
End Sub
If mDirty Then
jAnswer = MsgBox("Do You Want To Save The Changes You Made To Users?", vbYesNoCancel +
vbExclamation, "DB Tester")
Case vbYes
Call cmdControl_Click(3)
Cancel = False
Case vbNo
'User clicked No
'Does not wish to save changes, So unload the form without saving
Cancel = False
Case vbCancel
End Select
End If
End Sub
frmVote.Show
rsUsers.Close
cnAP.Close
End Sub
'User changed data in the textbox, change the property Dirty to True
DimControls "0,0,0,1,1"
DimNav "0,0,0,0"
mDirty = True
End If
End Sub
DimControls "0,0,0,1,1"
DimNav "0,0,0,0"
mDirty = True
End If
End Sub
EmptyDB = True
Else
EmptyDB = False
End If
End Function
With rsUsers
jPos = .AbsolutePosition
jCount = .RecordCount
End With
DimNav "0,0,1,1"
Else
DimNav "1,1,0,0"
Else
DimNav "1,1,1,1"
End If
End If
If jCount = 1 Then
DimNav "0,0,0,0"
End If
Else
DimNav "0,0,0,0"
End If
End Sub