+ Reply to Thread
Results 1 to 3 of 3

I am missing something here and I don't know what.

  1. #1
    Registered User
    Join Date
    03-10-2024
    Location
    London, England
    MS-Off Ver
    365 For Business
    Posts
    3

    I am missing something here and I don't know what.

    Hi,

    I'd appreciate you patience here as I'm 40 and trying to teach myself how to code. Full disclosure I'm following a YouTube guide and despite having the same code I'm getting different results.

    I have two main problems here:

    1. When I edit a record it will create a new line rather than editing the existing line. When I click save on an existing record I'd like that to change rather than a new one being created. Each "Load ID" should be unique. I'll work on a filter that stops the duplication of Load ID's later.

    2. The search function will not play ball. Either the button is greyed out or nothing happens when I click with a search term. If no search term is entered it will show the msgBox I've programmed.

    This line of code is causing no end of issues. I thought I had if fixed in the debugger but now its stopping me deleting rows.

    iRow = Application.WorksheetFunction.Match(Me.lstDatabase.ListIndex(Me, lstDatabase.ListIndex, 0), _
    ThisWorkbook.Sheets("Database").Range("A:A"), 0)

    Before it was showing a Compile error: Expected:expression


    I've attached the sheet. Rather than just fixing it I'd far rather know where I'm going wrong and how to fix it.

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: I am missing something here and I don't know what.

    2) the button is grey out is due to your code (enabled=false) - follow your code path through when you open the form.
    do not use CountA to find row - this only works in this instance as you are starting from row 1 if your table started at row5 it would give you a wrong result because it counts rows with data in column A - not actual last row.
    I have attached a demo file using a 'structured table' for the data store in an application similar to yours - you will see the code is reasonable compact by using the default textbox names and simply looping through them rather than tediously rename each and then having to reference each individually.
    The attached PDF gives a better view of the code paths - there is no need for separate module as all the code is contained within the userform module.
    Attached Files Attached Files
    Torachan,

    Mission statement; Promote the use of Tables, Outlaw the use of 'merged cells' and 'RowSource'.

  3. #3
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,223

    Re: I am missing something here and I don't know what.

    Ad.1 In the Submit procedure, delete the second occurrence of the code line:
    Please Login or Register  to view this content.
    Artik

+ 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. Replies: 2
    Last Post: 06-01-2022, 12:18 PM
  2. Replies: 2
    Last Post: 09-28-2020, 03:35 AM
  3. [SOLVED] macro is showing as data missing but it is not missing and cant get it to amend.
    By tweacle in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-23-2020, 03:32 PM
  4. [SOLVED] Compare two columns on separate sheet, if missing, insert missing data
    By lilvictorians in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 04-03-2019, 11:44 PM
  5. Data missing in WorkBooka after VBA Macro SAVE AS due to ComboBox source is missing
    By Purovagos in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-23-2014, 09:38 PM
  6. Excel Macro to find missing dates and insert missing date as blank row
    By JevaMarie in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-26-2013, 11:08 AM
  7. Replies: 2
    Last Post: 08-01-2005, 09:39 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