CyrusMacsen
Registered User.
- Local time
- Today, 14:44
- Joined
- Feb 16, 2004
- Messages
- 20
I' m a self taught learner in Access and this is my first major project. I'm writing a database to manage a MWR facility. It has a tracking system by user that contains what MWR asset they got on, at what time on what date and when they got off. So far I have been doing ok, perusing these forums finding solutions to any thing I have run upagainst so far. However this is just killing my brain. I'm sure its pretty simple, but I'm missing the obvious from looking at it soo long.
What I'm doing is taking a LogOn date/time object and trying to increase the minutes by a select amount. At this time it is only 30 minutes. This is so I can put in the LogOff date/time object the projected log off time. Right now I know there is a error in the way I coded it, but it was the easiest way to show you in code what I was attempting. I've tried doing similar things in update queries but am having no luck with that either.
Here is my code snipet:
--------Begin Code Snipet--------------------------
Private Sub LogOFF_Click()
On Error GoTo Err_LogOFF_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim stQueryName As String
Dim TiHourOn As Integer
Dim TiMinOn As Integer
Dim TiSecOn As Integer
'Hide the parent frame for cleaner appearance
Me.Visible = False
stDocName = "LogOff"
stQueryName = "TimeOff"
'Adjusting the TimeOff value to be offset by 30min from TimeOn
'Needs to be stored in table "MWR Manager"
TiHourOn = DatePart("hh", [MWR Manager].[TimeOn])
TiMinOn = DatePart("nn", [MWR Manager].[TimeOn])
TiSecOn = DatePart("ss", [MWR Manager].[TimeOn])
'Time adjustment formula
[MWR Manager].[TimeOff] = [MWR Manager]. DateEntered] + Time(TiHourOn, TiMinOn + 30, TiSecOn)
stLinkCriteria = "[MWRName]=" & "'" & Me![MWRName] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_LogOFF_Click:
Exit Sub
Err_LogOFF_Click:
MsgBox Err.Description
Resume Exit_LogOFF_Click
End Sub
------------------End Code Snipet--------------------
Any help you can provide is appreciated. Basically I am trying to do various complex numerical functions in code so its automated and then have it write back and store the value in that appropriate location in a table. Guidance and suggestions are always welcome. Thanks.
What I'm doing is taking a LogOn date/time object and trying to increase the minutes by a select amount. At this time it is only 30 minutes. This is so I can put in the LogOff date/time object the projected log off time. Right now I know there is a error in the way I coded it, but it was the easiest way to show you in code what I was attempting. I've tried doing similar things in update queries but am having no luck with that either.
Here is my code snipet:
--------Begin Code Snipet--------------------------
Private Sub LogOFF_Click()
On Error GoTo Err_LogOFF_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim stQueryName As String
Dim TiHourOn As Integer
Dim TiMinOn As Integer
Dim TiSecOn As Integer
'Hide the parent frame for cleaner appearance
Me.Visible = False
stDocName = "LogOff"
stQueryName = "TimeOff"
'Adjusting the TimeOff value to be offset by 30min from TimeOn
'Needs to be stored in table "MWR Manager"
TiHourOn = DatePart("hh", [MWR Manager].[TimeOn])
TiMinOn = DatePart("nn", [MWR Manager].[TimeOn])
TiSecOn = DatePart("ss", [MWR Manager].[TimeOn])
'Time adjustment formula
[MWR Manager].[TimeOff] = [MWR Manager]. DateEntered] + Time(TiHourOn, TiMinOn + 30, TiSecOn)
stLinkCriteria = "[MWRName]=" & "'" & Me![MWRName] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_LogOFF_Click:
Exit Sub
Err_LogOFF_Click:
MsgBox Err.Description
Resume Exit_LogOFF_Click
End Sub
------------------End Code Snipet--------------------
Any help you can provide is appreciated. Basically I am trying to do various complex numerical functions in code so its automated and then have it write back and store the value in that appropriate location in a table. Guidance and suggestions are always welcome. Thanks.