Page 2 of 2 FirstFirst 12
Results 16 to 27 of 27
  1. #16
    d9pierce1 is offline Expert
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    754

    I tried setting that to >1 and still wont edit?

  2. #17
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,389
    Test Buttons-davegri-V01.zip
    This should be a lot closer to what you want.

  3. #18
    d9pierce1 is offline Expert
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    754
    Hi davegri,
    That works so nicely, cant thank you enough. If I can get my edit figured out I am all set. Thank you so much! Perfect!
    Dave

  4. #19
    d9pierce1 is offline Expert
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    754
    Hi davegri,
    I waslooking over and I see a Private Sub GetRecordToEdit(KeyArg As Long), do I need to call this on my edit button or save button also? I hit edit button, edit record, and save, then it fires the code before update and doesn't save the record?
    Thanks

  5. #20
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,389
    Test Buttons-davegri-V02.zip
    Didn't test that, not realizing you might just edit the displayed stored rec.

    Added public boolean variable eMode.
    Last edited by davegri; 12-03-2018 at 12:24 PM. Reason: clarif

  6. #21
    d9pierce1 is offline Expert
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    754
    Thank you,
    That works like a charm. You are a genius!
    I really appreciate this.
    Dave

  7. #22
    d9pierce1 is offline Expert
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    754
    Hi davegri
    I really hate to ask but could i get a look at the CboStateID_NotOnList as i have been working on it all day and cannot get it past errors. I use to be able to do that but has been so long i just cant figure out what i am doing wrong with trying to get a not on list event on the cboStateID field. the code below is what I was working with and will open form, but I cant get it to save it so I can put it in my Frm_City without closing it. I have placed requery at various point with no success, they have been removed. I also attached the db.zip. I really hate to ask for help on this one but I just cant get it past error.
    Thanks
    dave


    Code:
    Private Sub cboStateID_NotInList(NewData As String,Response As Integer)
    
        Dim ctrl AsControl
        Dim strMessageAs String
    
        Set ctrl =Me.ActiveControl
        strMessage ="Add " & NewData & " “
    
        IfMsgBox(strMessage, vbYesNo + vbQuestion) = vbYes Then
           DoCmd.OpenForm "frm_State", _
               DataMode:=acFormAdd, _
               Windowmode:=acDialog, _
               OpenArgs:=NewData
            ' ensurefrm_State closed
            DoCmd.CloseacForm, "frm_State"
            ' ensurecontact has been added
            If NotIsNull(DLookup("StateID", "Tbl_State", “TxtState  = ” & _
                NewData& """")) Then
            Response =acDataErrAdded
            Else
                strMessage= NewData & " was not added to State table."
                MsgBoxstrMessage, vbInformation, "Warning"
               Response = acDataErrContinue
               ctrl.Undo
            End If
        Else
            Response =acDataErrContinue
            ctrl.Undo
        End If
    
    End Sub

  8. #23
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,389
    Maybe you attached the wrong DB. There is no VBA in the attached DB.
    I also can't tell from your description what form is the problem.

  9. #24
    d9pierce1 is offline Expert
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    754
    Test Buttons-davegri-V02.zip

    Hi davegri,
    I dont know what happened on the upload. I have attached a new copy of it. I was trying to use the code above for a NotOnList event in my frm_Cities. It would open the form, let me add a record, save and close, but wouldn't update the cbo_StateID and came up with "Restriction" error when I fired the not on list event. Ideally, I wanted to use a not on list on the cboStateID, Open frm_State, have the Txt entered into the filed State that I was trying to add, Set focus on the StateName, Enter State Name, Save, Close form, and have that entered into my open frm_Cities! That would be the ideal case. Something about the not in list is not working with my current code in the before update event in Frm_Cities
    Thanks Again
    Dave

  10. #25
    d9pierce1 is offline Expert
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    754
    HI davegri,
    I have been working on this and have almost got it working correctly. I have attached the newest work here. Now, if I click add in frm_City, type in new city, tab to state, enter a new state (Like CC) or something else that is not in list, then msgbox do you want to add, yes, and then the restriction comes up from before update event, then it opens up Frm_State, lets me enter info (however, the Txt I entered doesn't transfer to State) but then I enter the info and hit save, hit close, then msgbox "Text you entered not in the list" Please select.....OK, Then if you go back to list, its in the list.

    I beleive this will work, just need to figure out the errors.
    \
    Thanks
    Dave

    Test Button NOL.zip

  11. #26
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,389
    Test Buttons-NOL-V01.zip

    This should not be so complicated. I've simplified the method of Not in list to automatically open the state form via the state combobox property in the city form. The not-in-list code is commented out.
    You should really look at other ways to eliminate the confusing jumble of code.

  12. #27
    d9pierce1 is offline Expert
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    754
    Thanks davegri,
    That works good. I am learning slowly and have enrolled in a coarse that starts in Jan for Access and VBA so that should help.
    Have a great day and thanks again.
    Dave

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

Similar Threads

  1. How to edit the event
    By bk6741 in forum Forms
    Replies: 3
    Last Post: 10-02-2017, 03:56 PM
  2. Replies: 7
    Last Post: 05-08-2014, 10:34 AM
  3. [Event Procedure] to edit a record
    By Aloupha in forum Forms
    Replies: 12
    Last Post: 11-07-2013, 03:09 PM
  4. Replies: 22
    Last Post: 09-21-2013, 01:47 PM
  5. Replies: 1
    Last Post: 08-24-2012, 06:50 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