Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 39
  1. #16
    tygereye is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    18

    Could you explain how to do that?
    If it will help at all, I am adding a picture of the field properties in the source table (tblBatches). Are these settings correct?
    Click image for larger version. 

Name:	Table field properties.JPG 
Views:	10 
Size:	42.2 KB 
ID:	15891

  2. #17
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Put a MsgBox in the code at the beginning and see if it displays.

  3. #18
    tygereye is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    18
    I put in this:
    Private Sub Form_Load()
    MsgBox “Haha!”, , "Laugh"
    End Sub


    And upon opening the form, I got the following message:
    Run-time error '424':
    Object required

  4. #19
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Change it to: MsgBox "Haha!" and put it in the Batch_Number code.

  5. #20
    tygereye is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    18
    I put in:
    Private Sub Batch_Number_GotFocus()
    MsgBox "Haha!"
    End Sub
    That worked perfectly!

    Thanks so much for all your trouble. Now we just need to get the conditional message box right...
    I truly appreciate your help!

  6. #21
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    You need to put that MsgBox in the BeforeUpdate event of the Batch_Number control so we can make sure it is executing.

  7. #22
    tygereye is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    18
    That worked perfectly!

  8. #23
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Are you now rejecting duplicate numbers?

  9. #24
    tygereye is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    18
    No, the message box with the "Haha" only worked. I tried the code you suggested again, but no luck.

  10. #25
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Please post *all* of the code you currently have in the BeforeUpdate event that includes the MsgBox.

  11. #26
    tygereye is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    18
    This is all.

    If I include
    MsgBox "Haha!"
    Then this message box appears as one moves to the next field, but the message (=[MacroError].[Description]) appears only when saving the whole form at the end of completing all the fields.

    Here's the code:
    Private Sub Batch_Number_BeforeUpdate(Cancel As Integer)
    With Me.RecordsetClone
    .FindFirst "LotNumber ='" & Me.Batch_Number & "'"
    If Not .NoMatch Then
    MsgBox "This batch number [" & Me.Batch_Number & "] has already been logged!" & vbCrLf & _
    "For Re-Assays, add suffix RE1 or RE2, as necessary.", vbOKOnly, "Duplicated entry"
    Me.Batch_Number.Undo
    Cancel = True
    End If
    End With
    End Sub

    If I leave out
    [" & Me.Batch_Number & "]
    in
    MsgBox "This batch number [" & Me.Batch_Number & "] has already been logged!" & vbCrLf & _
    it still does the same.

  12. #27
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Something is not right. Any chance you can post your db? Zip it up first.

  13. #28
    tygereye is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    18
    This is mind boggling. It worked once, then not again. I changed nothing.
    I zipped the DB. Hope this works.
    Attached Files Attached Files

  14. #29
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    What is the password?

  15. #30
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    You cam PM me if you don't want it to be public.

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

Similar Threads

  1. Simple question
    By blackstatic42 in forum Access
    Replies: 4
    Last Post: 07-22-2020, 08:50 AM
  2. A simple question:
    By kosti in forum Queries
    Replies: 4
    Last Post: 10-12-2011, 11:46 AM
  3. Simple VBA Question
    By koper in forum Access
    Replies: 1
    Last Post: 01-20-2011, 12:07 PM
  4. Simple question
    By KenM in forum Queries
    Replies: 1
    Last Post: 11-10-2009, 03:32 PM
  5. Simple question?
    By roads.zx in forum Access
    Replies: 0
    Last Post: 10-15-2009, 04:56 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