Results 1 to 5 of 5
  1. #1
    gangel is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2014
    Posts
    194

    Use a variable as the "Select * From" source!

    Hey ppl,



    So i want to write this:

    Set IRS = CurrentDb.OpenRecordset("Select * FROM " & QuDiv & " WHERE [deactivate] = false and [ManualInvoicing] = false", dbOpenDynaset)

    SO i want to set QuDiv but i dont know what to save it as.

    I tried
    Dim QuDiv as object

    Set QuDiv = "QuPriceRptDiv1"

    and it came up as object error.

    Ideas?

  2. #2
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,927
    QuDiv should be a string

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    I dim everything as variant. (No dim needed for that)

  4. #4
    gangel is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2014
    Posts
    194
    awesome thanks!

  5. #5
    InsuranceGuy is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Aug 2015
    Location
    Colorado
    Posts
    126
    Quote Originally Posted by ranman256 View Post
    I dim everything as variant. (No dim needed for that)
    No man, just no.

    http://www.cpearson.com/excel/declaringvariables.aspx
    https://msdn.microsoft.com/en-us/lib...(v=vs.60).aspx
    http://spreadsheetsuperstar.com/vba-variant-data-type/

    Reconsider, please.

    Jeff

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 09-07-2015, 08:00 AM
  2. Replies: 3
    Last Post: 07-19-2014, 01:15 PM
  3. Replies: 4
    Last Post: 04-30-2014, 08:56 AM
  4. Replies: 1
    Last Post: 10-08-2012, 09:01 AM
  5. ComboBox "Select" and "DLookUp"
    By witooldas in forum Forms
    Replies: 0
    Last Post: 03-23-2011, 03:31 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums