Guest_imported
New member
- Jan 1, 1970
- 0
Hello,
I never touch MS Access before, but I get quiz from my boss. Can anybody help me out? Thank you very much for your kind help.
Jeannie
The folowing are questions:
***************************
'Please describe, in plain English, what the following snippets of code are doing
'Please make presumptions based on the information provided
===========================================================
Public Function KeyF(keyCode As Integer, strFormName As String, Optional _
strSubformName As String = "", Optional strSubSubFormName As String = "" _
As Integer
Dim ctl As Control
If strSubformName <> "" Then
If strSubSubFormName <> "" Then
Set ctl = Forms(strFormName).Controls(strSubformName).Form.Controls(strSubSubFormName).Form.ActiveControl
Else
Set ctl = Forms(strFormName).Controls(strSubformName).Form.ActiveControl
End If
Else
Set ctl = Forms(strFormName).ActiveControl
End If
Select Case intKey
Case Is = 43 'ASCII PLUS CODE
If keyCode = 43 Then intKey = 0
ctl = ctl + 1
keyCode = 0
Case Is = 45 'ASCII MINUS CODE
If keyCode = 45 Then intKey = 0
ctl = ctl - 1
keyCode = 0
End Select
End Function
==============================================================
Function GetDte(CurrentDate)
If VarType(CurrentDate) <> 7 Then
GetDte = Null
Else
Select Case WeekDay(CurrentDate)
Case 1
GetDte = CurrentDate - 6
Case 2
GetDte = CurrentDate
Case 3 To 7
GetDte = CurrentDate - WeekDay(CurrentDate) + 2
End Select
End If
CurrentDate = Date
End Function
==================================================================
UPDATE stuMain INNER JOIN psyIRTbl ON stuMain.StudID = psyIRTbl.IRStudID SET psyIRTbl.Selector = -1
WHERE (((stuMain.StudID)=[forms]![stuMainF]![txtStudID]));
==================================================================
Public Function whatAmIDoing() As String
Dim i As Integer
Randomize
i = Int((10000 * Rnd) + 1)
whatAmIDoing= "TMP" & Format(i, "000000"
End Function
==================================================================
Private Sub cmdProcess_Click()
Dim conn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim blnReturn As Boolean
Dim strSql As String
Dim strMsg As String
Me.Refresh
strMsg = "You are about to do something???"
If MsgBox(strMsg, vbYesNo, "!!!!!ATTENTION!!!!!" = vbYes Then
Set conn = CurrentProject.Connection
Set rst = New ADODB.Recordset
rst.Open Me.RecordSource, conn
Do Until rst.EOF = True
If rst!blnAccept = True Then
strSql = "UPDATE tblSchedule " & _
"SET tblSchedule.resID=" & rst!resID_New & _
" WHERE tblSchedule.ndxSched=" & rst!ndxSched
conn.Execute strSql
End If
rst.MoveNext
Loop
MsgBox "What you did is complete."
DoCmd.Close
End If
End Sub
======================================================================
Public Function whatAmIDoing()
Dim D As Integer
For D = 1 To 7
Select Case D
Case 7
Me("d" & D) = Forms!frmmain!txtStartOfWeek
Case 1
Me("d" & D) = Forms!frmmain!txtStartOfWeek + 1
Case 2
Me("d" & D) = Forms!frmmain!txtStartOfWeek + 2
Case 3
Me("d" & D) = Forms!frmmain!txtStartOfWeek + 3
Case 4
Me("d" & D) = Forms!frmmain!txtStartOfWeek + 4
Case 5
Me("d" & D) = Forms!frmmain!txtStartOfWeek + 5
Case 6
Me("d" & D) = Forms!frmmain!txtStartOfWeek + 6
End Select
Next D
End Function
=============================================================================
I never touch MS Access before, but I get quiz from my boss. Can anybody help me out? Thank you very much for your kind help.
Jeannie
The folowing are questions:
***************************
'Please describe, in plain English, what the following snippets of code are doing
'Please make presumptions based on the information provided
===========================================================
Public Function KeyF(keyCode As Integer, strFormName As String, Optional _
strSubformName As String = "", Optional strSubSubFormName As String = "" _
As Integer
Dim ctl As Control
If strSubformName <> "" Then
If strSubSubFormName <> "" Then
Set ctl = Forms(strFormName).Controls(strSubformName).Form.Controls(strSubSubFormName).Form.ActiveControl
Else
Set ctl = Forms(strFormName).Controls(strSubformName).Form.ActiveControl
End If
Else
Set ctl = Forms(strFormName).ActiveControl
End If
Select Case intKey
Case Is = 43 'ASCII PLUS CODE
If keyCode = 43 Then intKey = 0
ctl = ctl + 1
keyCode = 0
Case Is = 45 'ASCII MINUS CODE
If keyCode = 45 Then intKey = 0
ctl = ctl - 1
keyCode = 0
End Select
End Function
==============================================================
Function GetDte(CurrentDate)
If VarType(CurrentDate) <> 7 Then
GetDte = Null
Else
Select Case WeekDay(CurrentDate)
Case 1
GetDte = CurrentDate - 6
Case 2
GetDte = CurrentDate
Case 3 To 7
GetDte = CurrentDate - WeekDay(CurrentDate) + 2
End Select
End If
CurrentDate = Date
End Function
==================================================================
UPDATE stuMain INNER JOIN psyIRTbl ON stuMain.StudID = psyIRTbl.IRStudID SET psyIRTbl.Selector = -1
WHERE (((stuMain.StudID)=[forms]![stuMainF]![txtStudID]));
==================================================================
Public Function whatAmIDoing() As String
Dim i As Integer
Randomize
i = Int((10000 * Rnd) + 1)
whatAmIDoing= "TMP" & Format(i, "000000"
End Function
==================================================================
Private Sub cmdProcess_Click()
Dim conn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim blnReturn As Boolean
Dim strSql As String
Dim strMsg As String
Me.Refresh
strMsg = "You are about to do something???"
If MsgBox(strMsg, vbYesNo, "!!!!!ATTENTION!!!!!" = vbYes Then
Set conn = CurrentProject.Connection
Set rst = New ADODB.Recordset
rst.Open Me.RecordSource, conn
Do Until rst.EOF = True
If rst!blnAccept = True Then
strSql = "UPDATE tblSchedule " & _
"SET tblSchedule.resID=" & rst!resID_New & _
" WHERE tblSchedule.ndxSched=" & rst!ndxSched
conn.Execute strSql
End If
rst.MoveNext
Loop
MsgBox "What you did is complete."
DoCmd.Close
End If
End Sub
======================================================================
Public Function whatAmIDoing()
Dim D As Integer
For D = 1 To 7
Select Case D
Case 7
Me("d" & D) = Forms!frmmain!txtStartOfWeek
Case 1
Me("d" & D) = Forms!frmmain!txtStartOfWeek + 1
Case 2
Me("d" & D) = Forms!frmmain!txtStartOfWeek + 2
Case 3
Me("d" & D) = Forms!frmmain!txtStartOfWeek + 3
Case 4
Me("d" & D) = Forms!frmmain!txtStartOfWeek + 4
Case 5
Me("d" & D) = Forms!frmmain!txtStartOfWeek + 5
Case 6
Me("d" & D) = Forms!frmmain!txtStartOfWeek + 6
End Select
Next D
End Function
=============================================================================