+ Reply to Thread
Results 1 to 8 of 8

vba search based on address in database

  1. #1
    Registered User
    Join Date
    03-22-2014
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    47

    vba search based on address in database

    Hi, I have to print all the students who live in Florida. Keeps saying no current record but in my database there are students from Florida.

    Please Login or Register  to view this content.
    Last edited by excel girl; 11-08-2015 at 04:29 PM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,917

    Re: vba functions

    Please take a moment to read the forum rules and then amend your thread title to something descriptive of your problem - not what you think the answer might be. (think google search terms?). Once you have done this please send me a PM and I will remove this request. (Also, include a link to your thread - copy from the address bar)

    Many members search our previous posts, and thread titles play a big part of the search. I doubt anybody would do a search based on your title?

    To change a Title on your post, click EDIT POST then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (note: this change is not optional )
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: vba functions

    Suggest removing the

    Please Login or Register  to view this content.
    line and the corresponding End If line to see if anything is being pulled back. If it isn't then you problem is elsewhere.

    You might want to make the title of this thread a bit more descriptive to allow others to benefit from your question in the future.
    Martin

  4. #4
    Registered User
    Join Date
    03-22-2014
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    47

    Re: vba search based on address in database

    Mince, I put that line in order to check for students from Florida. The debugger keeps highlighting that line but I need to search based on Address.

  5. #5
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: vba search based on address in database

    What happens if you remove the lines I suggested - do you get a lot of output appearing in the Immediate pane or nothing at all?

    I also noticed that you had a field called StudenttName - could this be a misspelling?

  6. #6
    Registered User
    Join Date
    03-22-2014
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    47

    Re: vba search based on address in database

    No output when I removed as you suggested. No StudentName is an actual field.

  7. #7
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2403 Win 11 Home 64 Bit
    Posts
    23,811

    Re: vba search based on address in database

    I just noticed that your field for the name has two t's in the field name

    StudenttName Is this a typo or an error in your code and is this the reason your code may be failing?

    Otherwise have you considered running a query from the QBE to get the results.
    Last edited by alansidman; 11-09-2015 at 08:48 PM.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  8. #8
    Registered User
    Join Date
    11-23-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007/10
    Posts
    18

    Re: vba search based on address in database

    why not just incorporate into your openrecordset

    Set rec = db.OpenRecordset("SELECT * FROM StudentsInfo WHERE Address='Florida'")

    just to be clear - are your addresses just 'Florida','Texas' or do they contain other elements such as a house number, city, postcode etc?

    If they do then your search won't work because = means the whole field, you would use LIKE instead with *'s

    Set rec = db.OpenRecordset("SELECT * FROM StudentsInfo WHERE Address Like '*Florida*'")

+ 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: 6
    Last Post: 03-17-2015, 01:35 AM
  2. VBA – User Designed Functions (UDF) - Renaming array functions
    By hbsonly in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-03-2013, 02:00 PM
  3. Which Excel functions work in user-defined functions ?
    By RogeratCCCC in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 04-28-2012, 06:47 PM
  4. Replies: 1
    Last Post: 02-10-2012, 05:27 PM
  5. Replies: 0
    Last Post: 11-15-2007, 05:24 AM
  6. Replies: 2
    Last Post: 07-13-2006, 11:30 PM
  7. [SOLVED] Conversion from Spreadsheet Toolkit functions (ESSV....) to EssBase API functions
    By sujay in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-05-2006, 05:20 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