none
Access Form On Exit event RRS feed

  • Question

  • Good morning.

    I have an On Exit event for a text box 'CMS ID' that fills in data on a data entry form, if there is data available (pulling in data from another table based on the CMS ID).  The event works as it should however if the data is cleared from the CMS ID and new data is entered (in the event the CMS ID was keyed incorrectly / typo) the information does not update as it did the first time the data was entered for the CMS ID.

    Attached is the On Exit event which works correctly the first time but does not update if the CMS ID is updated.. Any feedback or suggestions would be greatly appreciated.  Thank you for your time.

    I do want to add the CustomerFirstName, CustomerLastName,CustomerStreetAddress does change when the CMS ID changes it’s the First_Name, Last_Name, Address that does not change / update.. if that makes any sense.

    Private Sub CMS_ID_Exit(Cancel As Integer)

    [Completed_By] = theUserName()

    If IsNull([Letter Type]) Then

    [Letter Type].Value = Form.RecordSource

    End If

    If IsNull([First_Name]) = True Then

    [First_Name]=CustomerFirstName]

    End If

    If IsNull([Last_Name]) = True Then

        [Last_Name] =[CustomerLastName]

    End If

    If IsNull([Address]) = True Then

        [Address] =   [CustomerStreetAddress]

    End If

    If IsNull([City]) = True Then

        [City] = [CustomerCity]

    End If

    If IsNull([State]) = True Then

        [State] = [CustomerState]

    End If

    If IsNull([Zip_Code]) = True Then

        [Zip_Code] = [CustomerZipCode]

    End If

    If IsNull([DNR_Date]) = True Then

        [DNR_Date] = [DueDateDD]

    End If

    End Sub


    Tuesday, January 22, 2019 3:21 PM

All replies

  • Hi,

    Not sure if this will help but rather than the Exit event, maybe you could try using the textbox's AfterUpdate event.

    Tuesday, January 22, 2019 4:06 PM
  • i think i figured out my problem.. the original code shows if is null but once the cms id updates its no longer null, as long as there is data there, so it doesnt update the 'refreshed data' if that makes any sense.. lol 

    i appreciate you taking time to respond me! thanks again!

    Tuesday, January 22, 2019 4:11 PM
  • Hi,

    Glad to hear you got it sorted out. Good luck with your project.

    Tuesday, January 22, 2019 4:25 PM