+ Reply to Thread
Results 1 to 5 of 5

Fecth data using Excel Userform

  1. #1
    Registered User
    Join Date
    10-02-2019
    Location
    leicester , england
    MS-Off Ver
    13
    Posts
    39

    Fecth data using Excel Userform

    Hi All,

    Can anyone help me with a statement to Find a Access db record specified from a Userform in Excel.

    I use the below to find the last entry in Access whuch works great.

    hsDBFullpath = "G:\QUALITY CLINIC\DATA\LongsInspectionDb1.accdb"
    hSQL = "SELECT MAX ([ID]) FROM [Inspectiondata]"

    Now I need to adapt this to "SELECT" the batch number ([BatchNumber)])FROM [Inspectiondata]" using the TEXTBOX (txtbatchnumber) from an excel userform.

    Any ideas ?

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Fecth data using Excel Userform

    If you already know what the batch number is, because it's in the TextBox then why do you need to retrieve it from the database at all?

    Are you trying to pull a whole record based on the batch number stored in the textbox?

    BSB

  3. #3
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Fecth data using Excel Userform

    Something like this if the batch number is numeric
    Please Login or Register  to view this content.
    or this if it's text
    Please Login or Register  to view this content.
    May need tinkering with a little... Difficult to know for sure without sample files.

    BSB
    Last edited by BadlySpelledBuoy; 01-26-2020 at 04:33 AM.

  4. #4
    Registered User
    Join Date
    10-02-2019
    Location
    leicester , england
    MS-Off Ver
    13
    Posts
    39
    Thanks bbs, I will give it a go.
    The userform in excel selects rows which need updating.
    So I have the batch number required and than I'll pull the drecord from the dB and update it accordingly.

  5. #5
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Fecth data using Excel Userform

    Aha, that makes sense now then.

    Note I've edited the SQL strings above as I forgot to take MAX out of it originally.

    BSB

+ 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] Fecth tables (or a single value) from IE an save the values
    By Mangorni in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 07-02-2019, 07:52 AM
  2. Excel VBA use userform to filter data and copy filtered data to new sheet
    By reiiling in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-31-2018, 09:36 AM
  3. Export CSV data to Excel Userform using reference number to specify relevant data
    By Sc0tt1e in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 06-20-2014, 05:41 PM
  4. combining chart userform and data transfer userform into 1 userform
    By H_Kennedy in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 01-04-2014, 07:11 AM
  5. combining chart userform and data transfer userform into 1 userform
    By H_Kennedy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-03-2014, 12:28 PM
  6. [SOLVED] EXCEL USERFORM- pull data from sheet 1 into userform
    By PANTECH in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-18-2013, 11:10 AM
  7. How to fecth number format of the cell/column
    By tushar@excel in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-12-2008, 02:52 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