Results 1 to 4 of 4
  1. #1
    sylbaryn is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2018
    Posts
    4

    Can I build a table using wildcards?

    Hi. I'm a bit of a newby so hope you can help advise me on the best approach to take here.



    I'm trying to link a pivot table in excel to a query in access. I can link up but I would like to be able to split my data in the pivot by 'month'. The thing is, I don't have a month field in the database and I can't use a date to extract the month because I'm looking for a 'work' month which means the date entry could actually be from the next/previous calendar month. What I do have is a reference that combines the month number and an ID so for instance 01-1234 would be from January and anything with "02-" at the start would be from February.

    My first thought was to create a table in access to link up "01-" with "Jan" and "02-" with Feb etc. However, I will have a few thousand entries starting with "01-". If I could use a wildcard asterisk that would do the trick. So "01-*" = Jan. But I don't think I can do this? Or can I?

    My second thought was to extract the first two characters from the combined reference

    My third though was to do something with a calculated cell within the excel pivot table.

    To be honest I'm not sure how to approach any of these option and in the back of my mind I'm thinking there must be an easier approach. Hence why I'm here

    Any guidance would be most appreciated.

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    In your Access query add a calculated field:
    WorkMonth: MonthName(Cint(Left([ID],2))) will give you January for ID="01-1234". Then use that in your pivot.

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #3
    sylbaryn is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2018
    Posts
    4
    That is surely witchcraft! Works a treat. Thank you very much

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    You're very welcome!

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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

Similar Threads

  1. Table using wildcards in field
    By Ekhart in forum Access
    Replies: 2
    Last Post: 12-20-2017, 09:01 AM
  2. Replies: 1
    Last Post: 10-16-2017, 07:38 AM
  3. Replies: 2
    Last Post: 06-29-2016, 09:37 AM
  4. Replies: 1
    Last Post: 06-12-2015, 02:02 PM
  5. Replies: 4
    Last Post: 05-26-2015, 12:21 PM

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