Results 1 to 13 of 13
  1. #1
    KAffleck is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2019
    Posts
    23

    Run Time error 3075

    Hi I keep getting Error 3075 when I try to run this code

    Private Sub MolWeightSerachBt_Click()
    DoCmd.OpenForm "MolWeightInterSearchFm", , , "Molecular WeightColm Like '#" & Me.MolweightSearchBx & "#'"
    DoCmd.Close acForm, Me.Name


    End Sub

    It says syntax error ( missing operator) in query expression "Molecular WeightColm Like '#".
    I'm new to all this so i have no clue what's wrong, I have used that expression to open another form and it works the only difference is the * instead of #.

  2. #2
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,016
    Why are you using the octothorp (#) instead of an asterisk? The octothorp indicates that delimited field is a DateTime Datatype.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    KAffleck is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2019
    Posts
    23
    Ah I though as it's numbers I needed to use #, I was previously using * but that gave me the same error. I'll change it back but I still get the same error.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    The inadvisable space requires you to bracket the field name.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    KAffleck is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2019
    Posts
    23
    Hi, Thanks that worked but I'm not getting any results in my form?

    It now opens the correct form but with nothing in it, sigh...

  6. #6
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    after Private Sub MolWeightSerachBt_Click() add
    Debug.print "(1) " & [Molecular WeightColm]
    debug.print "(2) " & Me.MolweightSearchBx
    save code and run again. If you don't get a value in the immediate window beside 1 and 2, your references are returning no values.
    When finished testing, remove or comment out the added lines. Alternatively you could use a message box rather than printout.
    Last edited by Micron; 07-25-2019 at 08:37 AM. Reason: code correction
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,016
    How is the field [Molecular WeightColm] defined? Is it defined as a Number...or is it defined as Text and simply consists of digits? 'Numbers' that are never used for math (IDs, Account Numbers, SSNs, etc.) are generally defined as Text.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  8. #8
    KAffleck is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2019
    Posts
    23
    That gives me another error.

  9. #9
    KAffleck is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2019
    Posts
    23
    It's long text field and it's rich text.


    Quote Originally Posted by Missinglinq View Post
    How is the field [Molecular WeightColm] defined? Is it defined as a Number...or is it defined as Text and simply consists of digits? 'Numbers' that are never used for math (IDs, Account Numbers, SSNs, etc.) are generally defined as Text.

    Linq ;0)>

  10. #10
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Quote Originally Posted by KAffleck View Post
    That gives me another error.
    That is of zero help to anyone.

  11. #11
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Did you try

    DoCmd.OpenForm "MolWeightInterSearchFm", , , "[Molecular WeightColm] Like '*" & Me.MolweightSearchBx & "*'"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  12. #12
    KAffleck is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2019
    Posts
    23
    Hi, Thanks but that gives me a blank form as well


    Quote Originally Posted by pbaldy View Post
    Did you try

    DoCmd.OpenForm "MolWeightInterSearchFm", , , "[Molecular WeightColm] Like '*" & Me.MolweightSearchBx & "*'"

  13. #13
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Like '*'" & Me.MolweightSearchBx & "'*'" ?
    Note the 2 added single quotes.

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

Similar Threads

  1. Replies: 13
    Last Post: 05-31-2019, 10:48 PM
  2. Replies: 2
    Last Post: 01-04-2016, 09:40 AM
  3. Replies: 11
    Last Post: 05-01-2014, 11:56 AM
  4. Replies: 3
    Last Post: 03-05-2013, 11:17 AM
  5. Replies: 6
    Last Post: 05-30-2012, 12:32 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