+ Reply to Thread
Results 1 to 9 of 9

Verify if record has been posted to database before posting

  1. #1
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Verify if record has been posted to database before posting

    I have written a macro to post a record to a database but want to check if the record is already in the database before I post the record? I have attached a sample file.
    Thanks in advance
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Re: Verify if record has been posted to database before posting

    I have made an attempt at the code but besides being inelegant, it does not work?
    Sub PostWeek()
    Please Login or Register  to view this content.
    Thanks in advance

  3. #3
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Re: Verify if record has been posted to database before posting

    I am receiving an error message "Object variable not set" for the "IF Selection" line of code? Would really appreciate some guidance.
    Thanks in advance

  4. #4
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Re: Verify if record has been posted to database before posting

    I have tried some different code but still can't figure this out? The logic I am trying to apply is that if the weeknumber has been posted, a vlookup will result in a positive number and if the week has not been posted, the vlookup will result in #NA.

    Please Login or Register  to view this content.
    Thanks in advance

  5. #5
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Re: Verify if record has been posted to database before posting

    I have attached a sample file with new code that has a problem with the Vlookup line?
    Thanks in advance
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Re: Verify if record has been posted to database before posting

    Is there an easy answer to this problem? I am hoping so.
    Thanks in advance

  7. #7
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Verify if record has been posted to database before posting

    Hi Aland2929

    Try this
    Please Login or Register  to view this content.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  8. #8
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Re: Verify if record has been posted to database before posting

    Thank you very much. Works perfectly. I added the following code at to de-select the range:
    Please Login or Register  to view this content.

  9. #9
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Verify if record has been posted to database before posting

    Hi Aland2929

    You're welcome...glad I could help. Thanks for the Rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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