Results 1 to 10 of 10
  1. #1
    Join Date
    Sep 2013
    Posts
    25

    Unanswered: Show a message in a form every 10 (or any other set number of) records are filled?

    I need the form to, every 10 records are entered, pop up a message display alerting that 10 records have been entered (the db is about purchases and my boss wants to do some quality control every 10 purchases of the same product).
    So far I made this query

    SELECT IIf([compras]![idcompra]/10=Round([compras]![Idcompra]/10.1),"yes","no") AS hola
    FROM compras;

    Which compares the 10th part of the record count with the 10th part of the record count ROUNDED UP to 0 decimals, and if they are the same, it means it is a multiple of 10 and so it assings the value "yes" to it.

    What i need is basically an afterupdate event in the form which looks up the last added value in the query and if it is "yes" pop up a message.



    Of course my approach may not be correct, if so please tell me how it should be done. Thank you very much!

  2. #2
    Join Date
    Nov 2011
    Posts
    413
    If Me.Recordset.RecordCount >10 Then
    'Do Something
    End If

  3. #3
    Join Date
    Sep 2013
    Posts
    25
    Thanks for the reply! but i don't think it'll work to my needs. I need that message to pop up only when the recordcount is 10, or 20, or 30, or 40, etc, by increments of 10. Still, i'll take it from here thank you very much!

  4. #4
    Join Date
    Sep 2013
    Posts
    25
    Now that i've thought about it better, i don't think that answer would help, because i need the message to show up each time a particular product gets entered every 10 times. Im pretty sure my query comes into play

  5. #5
    Join Date
    Nov 2011
    Posts
    413
    Then just change to a DLookup for your Record Count for ProductID.

  6. #6
    Join Date
    Sep 2013
    Posts
    25
    Bare with me, i have just started using Access, can you provide some example code?

  7. #7
    Join Date
    Nov 2011
    Posts
    413
    If DCount("[ProductID]", "tblProducts") >10 Then
    'Do Somewhing
    End If

  8. #8
    Join Date
    Oct 2013
    Posts
    8
    It isn't clear whether how the query is related to the form, but if you want to respond to record entries in the form,then add the following function to the form module and call from the form's afterupdate event

    private Function fSelect(iInterval As Integer)
    Dim sng As Single

    If isdirty(Me) Then Me.Dirty = False
    If Me.Recordset.RecordCount > 0 Then
    sng = Me.Recordset.RecordCount / iInterval

    If sng = vbInteger Then
    MsgBox "HOLA"
    End If
    End If
    End Function

    Cheers,

  9. #9
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    The value of the intrinsic constant vbInteger is 2. I don't see how:
    Code:
    sng = Me.Recordset.RecordCount / iInterval
    If sng = vbInteger Then
    which is equivalent to:
    Code:
    If Me.Recordset.RecordCount / iInterval = 2 Then
    could solve the problem. I would use something like:
    Code:
    If Me.RecordCount Mod 10 = 0 then
    Or:
    Code:
    If DCount("*", "SourceTableName") Mod 10 = 0 Then
    Have a nice day!

  10. #10
    Join Date
    Oct 2013
    Posts
    8
    Sinndho is absolutely correct. The solution I proposed will NOT work. My apologies for the confusion.

    Cheers, Hambakahle

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
  •