Results 1 to 11 of 11
  1. #1
    d9pierce1 is offline Expert
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    776

    Not In List and Null Values Questions

    Hi all,
    This is somewhat of a re-post on some earlier post i did but with new questions.
    I have worked hard cleaning up the code in this db thispast week. I am still having some issues getting things to work correctly andwould really appreciate some assistance. I have tried everything I know how todo and have not been successful at these.

    Question 1;
    Frm_City
    I cannot get the Not in List event to work with my BeforeUpdate Event. Its like they are working against each other?

    Question 2;
    Frm_City
    The auto Expand does not work for the CboStateID? If Iclick on it, then it expands, if I start typing in a state, it doesn’t expand?Why?



    Question 3;
    Frm_City and Frm_State
    I cant get the code ValidData to work correctly when oneor more of the Txt / Cbo Fields are Null.
    It works but not the way intended. It saves a record eventhough I don’t have this data notnull.

    Questions4;
    Frm_City and Frm_State
    I cant edit the record with the Before Update Event. Itjust will not let me.
    Example, Frm_City, if I type in a misspelled CityName,then save, if I need to edit that, It takes me to the existing record. I needto be able to edit these Txt and Cbo even if ZipCode exist. This is typical on both forms.

    I just don’t know how to fix these issues to make thiswork correctly. Any assistance would be great.
    Thanks and I added the Db Zip. Other than these issues,it all works great!

    Test Buttons New.zip

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    1) I don't see not in list code in that form.

    2) allow edits is no, so you can't type in the combo for it to autoexpand.

    3) It should be called from the before update event of the form, and its result used to cancel the update.

    4) Untested as I need to look at a work project, but may be related to the aforementioned allow edits being No.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Eugene-LS's Avatar
    Eugene-LS is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Dec 2018
    Location
    Murmansk
    Posts
    17
    Quote Originally Posted by d9pierce1 View Post
    Question 1;
    Frm_City
    I cannot get the Not in List event to work with my BeforeUpdate Event. Its like they are working against each other?

    That event accurs in ComboBoxes and ListBoxes only. Yuor form object is TextBox!


    Quote Originally Posted by d9pierce1 View Post
    Frm_City
    The auto Expand does not work for the CboStateID? If Iclick on it, then it expands, if I start typing in a state, it doesn’t expand?Why?
    That methodt for ComboBoxes only. Yuor object is TextBox!

  4. #4
    d9pierce1 is offline Expert
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    776
    On the Frm_City is a CboStateID which is a combo box!

  5. #5
    d9pierce1 is offline Expert
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    776
    Hi,
    The code I was using for Not in List is at the bottom of editor in Frm_City and I commented it out as it was giving me to much grief but kept it, just ' it out
    Thanks

  6. #6
    d9pierce1 is offline Expert
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    776
    Thanks,
    I looked over, set to allow edits and additions, no difference in the Expand when typing. Now, it is also set to allow edits and additions when CmdEdit_Click too.
    But no change in expanding it.

  7. #7
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    I had to stop your code from setting that to No in the load event. Playing with it, I got it to auto expand by reversing the fields and making the bound column 2.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    d9pierce1 is offline Expert
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    776
    Thanks for the help. I played with that most of the day and couldn't get it to work?
    dave

  9. #9
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    I mean the row source became:

    SELECT Tbl_State.State, Tbl_State.StateID FROM Tbl_State ORDER BY Tbl_State.State;

    the bound column 2, and the column widths 1";0".
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    d9pierce1 is offline Expert
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    776
    I need to find a way to exit this sub if....so that I can edit the fields in the record. Here are my thoughts,
    I add a ChkDup checkbox on form. Set AddNew to force check, Set Edit to force uncheck. Then in my before update event code I need an if statement,
    Something as

    If Me.ChkDup = 0 Then
    Do.Command.Save?
    Exit Sub
    Else If Me.ChkDup = -1 Then
    Continue with the before update evnt
    End If

    I would love some help writing this above to be correct language
    Thanks
    Dave

  11. #11
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    In the before update event you set cancel = true:

    http://www.baldyweb.com/BeforeUpdate.htm
    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. Replies: 5
    Last Post: 09-22-2017, 06:01 PM
  2. Replies: 2
    Last Post: 04-17-2017, 01:40 PM
  3. Replies: 7
    Last Post: 12-04-2013, 01:55 PM
  4. Finding the Max Date and Null Values if Null
    By SpdRacerX in forum Queries
    Replies: 1
    Last Post: 02-03-2012, 06:29 AM
  5. List box questions
    By SteveL5231 in forum Forms
    Replies: 1
    Last Post: 12-15-2010, 08:43 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