Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    napiedra is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    17
    I found another issue:

    The following Code:

    Option Compare Database
    Private Sub Form_Load()
    DoCmd.ShowToolbar "Ribbon", acToolbarNo
    DoCmd.GoToRecord acDataForm, "CTParkingLLC", acNewRec
    Forms!CTParkingLLC!FindTAG.SetFocus


    End Sub
    Private Sub FindTAG_AfterUpdate()
    If (FindTAG & vbNullString) = vbNullString Then Exit Sub
    Dim rs As DAO.Recordset
    Set rs = Me.RecordsetClone
    rs.FindFirst "[TAG]=" & FindTAG
    If rs.NoMatch Then
    DoCmd.GoToRecord acActiveDataObject, , acNewRec
    Me!TAG = Me.FindTAG
    Me.TimeIn = Now()
    Me.HoulyRate = 7
    Else
    Me.Recordset.Bookmark = rs.Bookmark
    Me.TimeOut = Now()
    Me.ElapsedTime = DateDiff("n", [TimeIn], [TimeOut])
    End If
    X = [ElapsedTime] / 60 * [HoulyRate]
    If X < 2 Then
    Me.AmountOwed = 2
    Else
    Me.AmountOwed = X
    End If
    rs.Close
    FindTAG = Null
    End Sub


    What happens is that if my mistake the software user scan a record that has a TimeOut already I need to provide a pop up box to say, "Invalid Record"

    The problem is that if there is a record there that already has a TimeIn and a TimeOut with an HourlyRate already calculated and by mistake the software user scans the old record barcode again it updates the TimeOut again adn calculate the rate again to a higher value.

    What I need it to do is the following:


    Before the following code it needs to check the TimeOut and only execute the following code if the TimeOut is Null but if there is value in the TimeOut it needs to give a pop up as invalid record.

    Me.Recordset.Bookmark = rs.Bookmark
    Me.TimeOut = Now()
    Me.ElapsedTime = DateDiff("n", [TimeIn], [TimeOut])

    Thanks for everything...

  2. #17
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Try:
    Code:
    Private Sub FindTAG_AfterUpdate()
    If Me.FindTAG & vbNullString <> vbNullString Then
        Dim rs As DAO.Recordset
        Set rs = Me.RecordsetClone
        rs.FindFirst "[TAG]=" & Me.FindTAG
        If rs.NoMatch Then
            DoCmd.GoToRecord acActiveDataObject, , acNewRec
            Me!Tag = Me.FindTAG
            Me.TimeIn = Now()
            Me.HoulyRate = 7
        Else
            Me.Bookmark = rs.Bookmark
            If IsNull(Me.TimeOut) Then
                Me.TimeOut = Now()
                Me.ElapsedTime = DateDiff("n", [TimeIn], [TimeOut])
                X = [ElapsedTime] / 60 * [HoulyRate]
                Me.AmountOwed = IIf(X < 2, 2, X)
            Else
                MsgBox "Invalid entry. Time Out already entered."
            End If
        End If
        rs.Close
        Me.FindTAG = Null
    End If
    End Sub
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #18
    napiedra is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    17
    It works beautiful, I am really impressed how you guys answer to people questions in a matter of minutes sometimes. This forum has been very helpful so me. I am sure a lof of us that are just starting to learn this really appreciate your help. Thank you very much!

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Programming of 'SAVE' button in Access 2010
    By THE STUDENT in forum Access
    Replies: 5
    Last Post: 06-07-2013, 01:23 PM
  2. VB programming Access 2010
    By engr_saud1 in forum Programming
    Replies: 2
    Last Post: 05-31-2013, 04:30 PM
  3. MS Access 2010 web database and Sharepoint 2010
    By sandeep23 in forum SharePoint
    Replies: 0
    Last Post: 06-05-2012, 11:44 AM
  4. Replies: 1
    Last Post: 01-05-2012, 02:34 PM
  5. Simple Programming Question
    By EvanRosenlieb in forum Programming
    Replies: 5
    Last Post: 11-18-2011, 04:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums