Page 3 of 4 FirstFirst 1234 LastLast
Results 31 to 45 of 51
  1. #31
    dtoxic's Avatar
    dtoxic is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Apr 2017
    Posts
    31
    Great, The Structure is fixed. I have entered a few data in the form and the Data is being saved in the readings table. But some readings are being repeated. Still needs a little work though. I will test it and see what can I do with it. And I will let you know if I face any problems.. Thanks a lot brother.

  2. #32
    dtoxic's Avatar
    dtoxic is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Apr 2017
    Posts
    31
    Test 3.zip

    I am Sending a file with Data... Check the tblreadings and the Query as well.. I think there is something wrong with the VBA. The data is kinda mixed up. And Yes The Date/Time.. There should be an option to enter a previous date as there is a lot of back date data that the user wants to input in the Database.

  3. #33
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    The Private sub TXTcurrentReading needs a slight change. See below
    The program now picks up if your value is less than the previous reading


    Code:
    Private Sub TxtCurrentReading_beforeUpdate(cancel As Integer)
    Dim myval As Long
    Dim mysql As String
    Dim MyPR As Long
    DoCmd.SetWarnings False
    MyPR = Me.TxtCurrentReading.Value
    mysql = "insert into tblreadings (PreviousReading, PumpID) values (" & MyPR & "," & Me.TxtPumpID.Value & ")"
    myval = DMax("CurrentReading", "tblReadings", "[pumpID] = " & Me.TxtPumpID.Value)
    
    If myval > Me.TxtCurrentReading Then
    MsgBox "Your value is too small compared to other readings and will not be updated", vbCritical
    cancel = True
    
    
    
    Exit Sub
    End If
    
    
    DoCmd.RunSQL (mysql)
    DoCmd.SetWarnings True
    End Sub

  4. #34
    dtoxic's Avatar
    dtoxic is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Apr 2017
    Posts
    31
    Great.. I will change the VBA and see how it works now.

  5. #35
    dtoxic's Avatar
    dtoxic is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Apr 2017
    Posts
    31
    Brother Andy. When I select something from the Combo, the Text does not Update in the PumpName field on the Form..

  6. #36
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Ok what is the vba for the combo onupdate event?


    Sent from my iPhone using Tapatalk

  7. #37
    dtoxic's Avatar
    dtoxic is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Apr 2017
    Posts
    31
    Private Sub Combo5_AfterUpdate()


    Me.Filter = "PumpID = " & Me.Combo5.Value
    Me.FilterOn = True




    Me.Requery
    End Sub

  8. #38
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    can you send your version please. It will be easier

  9. #39
    dtoxic's Avatar
    dtoxic is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Apr 2017
    Posts
    31
    Sure Here is My Version of the DB

    Test OLD Data.zip

    and Here is a sample of the OLD data.. I have just mentioned 3 Pumps in it just to show you how the old record is saved.

    TEST-4.zip

  10. #40
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051

    update

    test v3.zip

    try a few things

  11. #41
    dtoxic's Avatar
    dtoxic is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Apr 2017
    Posts
    31
    Sure.. I am entering some data to test this

  12. #42
    dtoxic's Avatar
    dtoxic is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Apr 2017
    Posts
    31
    Getting a Runtime Error while entering the Data in the FrmDailyReading form..

    Run-Time error "94"

    Invalid Use of Null.

  13. #43
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Ive altered this line. The Dmax statement is returning a "I cant find any data error because there's no readings so far. This change sorts it out.
    Code:
    myval = Nz(DMax("CurrentReading", "tblReadings", "[pumpID] = " & Me.TxtPumpID.Value), 0)
    And for usibility I've changed the field Readingdate so that it has a default of now()

  14. #44
    dtoxic's Avatar
    dtoxic is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Apr 2017
    Posts
    31
    I see, Can you please Send me Your Version where you altered the line in the VBA.

  15. #45
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051

    Version 4

    test v4.zip

    New version with alterations to vba

    Also Reading date will default to Now()

Page 3 of 4 FirstFirst 1234 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 11-02-2016, 11:41 AM
  2. Replies: 4
    Last Post: 03-01-2016, 12:04 PM
  3. Replies: 3
    Last Post: 11-08-2012, 10:38 AM
  4. Access: Updating Null Fields with values
    By bmaz in forum Queries
    Replies: 2
    Last Post: 10-11-2011, 05:18 PM
  5. Replies: 7
    Last Post: 11-13-2010, 08:08 AM

Tags for this Thread

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