Results 1 to 11 of 11
  1. #1
    tramp82 is offline Novice
    Windows XP Access 2000
    Join Date
    Oct 2011
    Posts
    13

    Record Check on Form OnLoad

    Hi! Hopefully someone can help me here.

    I have a form "Customers" with a command button which opens up another form "Customer_Orders". The form that opens up is a list of orders in a recordset which the customer has placed and all can be viewed by using the navigation buttons.

    Ok, so what I want is for the form to check to see if there are any orders placed . And if there aren't then we want a message to pop up straight away saying "No orders".
    No matter what I try I can't get this to auto happen, even though I can get it to work with an extra command button.

    Can anyone help? I've tried on form load, form open, form activate the lot.



    Thanks,

    Richard!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    What code do you use behind the button? I'd expect either the load or current events to work.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    tramp82 is offline Novice
    Windows XP Access 2000
    Join Date
    Oct 2011
    Posts
    13
    I got this for example (But I have tried .value = "", .text = "" etc)

    If IsNull(Me.Invoice_No) Then
    MsgBox ("No Orders")
    End If

    The form is called using an Access 2003 command button wizard if that makes a difference? I have posted it without the functions below if it has any relevance:

    Sub ToggleLink_Click()
    On Error GoTo ToggleLink_Click_Err

    If ChildFormIsOpen() Then
    CloseChildForm
    Else
    OpenChildForm
    FilterChildForm
    End If

    ToggleLink_Click_Exit:
    Exit Sub

    ToggleLink_Click_Err:
    MsgBox Error$
    Resume ToggleLink_Click_Exit

    End Sub

  4. #4
    tramp82 is offline Novice
    Windows XP Access 2000
    Join Date
    Oct 2011
    Posts
    13
    Anyone got any clue on this?

    I think it is POSSIBLY because the form is onload, does that load before the recordset and that's why it's not registering?

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Did you try the current event? The load event should work, as the data should be there. The open event is too early. Are you sure the field is Null?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    tramp82 is offline Novice
    Windows XP Access 2000
    Join Date
    Oct 2011
    Posts
    13
    Thank youuuuuu!!!! It works on the Form Current! Haven't ever used that before, but I still don't know why it doesn't work on FORM LOAD as I can see this is gonna be a problem for me in the future!?

    Thank you so much pb

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Happy to help. I would have thought it would work in the load event; perhaps something else is going on.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    tramp82 is offline Novice
    Windows XP Access 2000
    Join Date
    Oct 2011
    Posts
    13
    I'm not too amazing on this but I have noticed that it works when switching from design mode to the live mode. But not when I totally close and then Open?

    Is this something where the open event runs before a recordset is loaded? Or.... If so is there some way to get around it?

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    The open event runs before the load event, and doesn't have data. Can you post a sample of the failing db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    Paula is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    4
    Hi PBaldy,

    I am trying to help my niece with her SBA assignment but not sure if I am doing it right I have created the 3 tables personal, constituency and name&acronym but I am having problems importing the tables. Can you help? Would really appreciate it as it would make me look good

    http://wikieducator.org/images/1/1a/...abus_final.pdf

  11. #11
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Paula, you should really start a new thread with your question. It isn't related to the topic of this one.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Record Conflict Check
    By theilercabin in forum Forms
    Replies: 3
    Last Post: 10-11-2011, 01:55 PM
  2. Replies: 36
    Last Post: 10-04-2011, 11:19 PM
  3. Check if record exist
    By khhess in forum Programming
    Replies: 1
    Last Post: 06-14-2011, 06:56 PM
  4. To check or Un-Check all Boxes in a form
    By devcon in forum Forms
    Replies: 7
    Last Post: 05-01-2010, 12:03 AM
  5. Apply check at record level
    By wasim_sono in forum Programming
    Replies: 1
    Last Post: 04-19-2007, 07:48 AM

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