+ Reply to Thread
Results 1 to 6 of 6

Edit textbox in userform and write back to database using AfterUpdate

  1. #1
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Edit textbox in userform and write back to database using AfterUpdate

    I have a userform that highlights the data from the selected row in a search listbox

    I am trying to be able to edit text box 4 and write it back to to the database in column d

    I have tried many ways at this stage but cant find the syntax to write back to column "D" in that row in the source database

    Any help appreciated
    Please Login or Register  to view this content.
    Last edited by nigelog; 11-30-2016 at 05:27 AM.

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Edit textbox in userform and write back to database using AfterUpdate

    In your sample code you declare lngWriteRow but never assign a value to it so your line to update will fail with an error.

    How do you load the textbox with data? That's where you should store the source row number in lngWriteRow - but remember to change the scope of lngWrkteRow, it cannot be local to the event.

  3. #3
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Edit textbox in userform and write back to database using AfterUpdate

    cytop
    text box is populated from double clicking a record from the first userform. I forgot to add file on initial post
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Edit textbox in userform and write back to database using AfterUpdate

    Sorry, using a phone and there's no Android version of Excel... So will have to leave this for someone else to look at, but basically there's a double click event somewhere that loads the userform, you use that to also assign the current row value to a variable

  5. #5
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Edit textbox in userform and write back to database using AfterUpdate

    Thanks cytop, there is a double click event I'll look into

  6. #6
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Edit textbox in userform and write back to database using AfterUpdate

    Found a solution

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] SetFocus not working on TextBox after AfterUpdate
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 06-26-2022, 07:15 PM
  2. [SOLVED] Userform runs Initialize sub @ beginning of textbox AfterUpdate event w/out being called
    By chirp08 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-18-2016, 01:02 PM
  3. How to set cursor back to textbox on a userform when validating data?
    By excelkann in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-23-2016, 03:48 AM
  4. Replies: 4
    Last Post: 01-29-2014, 05:53 AM
  5. Populate row value in userform textboxes, edit and save the changes back in sheet.
    By p_nayak268 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-29-2013, 07:48 PM
  6. vba cmd button to assign for edit section of textbox values return back to acurate cell
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-26-2013, 05:01 AM
  7. [SOLVED] How do you edit the text in a userform-textbox?
    By John Keith in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-23-2006, 11:45 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1