Results 1 to 1 of 1

Thread: Using text in an excel cell drop down list to open Microsoft access to a specific record using VB.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member
    Join Date
    Feb 2021
    Posts
    3
    Rep Power
    0

    Using text in an excel cell drop down list to open Microsoft access to a specific record using VB.

    Moderator Notice:
    Copied by me from here
    Re https://excelfox.com/forum/showthrea...ecord-using-VB
    Alan









    Hello,
    I'm trying to get a daily menu spreadsheet synergizing with a recipe card database in MS access. (office 16)

    The issue:
    I have a dropdown menu in a cell in Excel. That dropdown list in Excel is generated from a table pulled in from a MS Access database "Recipe" table so I can click and change the daily menu item. When I click that dropdown cell with the current chosen context eg:"Alphabet Chilli" I want VB to use the text in that cell, to open the recipe card I've selected in MS Access form view. I'm trying to capture the text in that cell ("b8") ( also defined it as name "MondayMenu") as the filter criteria for MS Access using this line of code:

    oApp.DoCmd.OpenForm "Recipes", , , "RecipeName=" & Range("b8")

    That action generates this error:


    Microsoft Visual Basic

    Run-time error '3075':

    Syntax error (missing operator) in query expression
    'RecipieName=Alphabet Chilli',

    If I use this line of code and manually tell it the text I want to query using:

    oApp.DoCmd.OpenForm "Recipes", , , "RecipeName='Alphabet Chilli'"

    Everything works. The issue seems to be related to how it's parsing the ' characters, or lack there of.

    Suggestions? Please be kind , I'm new to this. XD
    Last edited by DocAElstein; 03-01-2021 at 12:23 PM. Reason: Copied from Excel sub Forum

Similar Threads

  1. Replies: 2
    Last Post: 03-10-2021, 08:35 PM
  2. Replies: 5
    Last Post: 09-06-2020, 01:51 PM
  3. Replies: 0
    Last Post: 10-24-2017, 09:39 PM
  4. Replies: 4
    Last Post: 07-27-2013, 01:34 PM
  5. Replies: 2
    Last Post: 07-23-2013, 06:54 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •