Results 1 to 14 of 14
  1. #1
    Tarl105 is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    7

    Angry DSUM generating "The expression you entered contains invalid syntax" error

    Whenever I attempt to enter the following DSUM expression in the Control Source property of a text box on my main form, it generates the above-mentioned error message. Using it without the criteria works. Can someone please assist me off the ledge? I have been battling this for about three hours.



    Here is my DSUM expression:

    =DSUM(“[ThawEmbThwd]”,”qryEmbThawFile”,”[CryoFileID]= [Forms]![frmActCCHEmb]![frmEmbCryoFile_Sub].[Form].[frmEmbThawFile_Csub].[Form]![txtCryoFileID]")

    Thanks,

    Tarl105

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    The target appears to be on a SubForm of a SubForm. Try moving the reference outside of the quotes:
    =DSUM(“[ThawEmbThwd]”,”qryEmbThawFile”,”[CryoFileID]= " & [Forms]![frmActCCHEmb]![frmEmbCryoFile_Sub].[Form].[frmEmbThawFile_Csub].[Form]![txtCryoFileID])

  3. #3
    Tarl105 is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    7
    RG, thanks for your quick response!

    I would like to verify that the following is your suggestion, I want to make sure that I didn't screw it up in copying:
    =DSUM(“[ThawEmbThwd]”,”qryEmbThawFile”,”[CryoFileID]= *" &* [Forms]![frmActCCHEmb]![frmEmbCryoFile_Sub].[Form].[frmEmbThawFile_Csub].[Form]![txtCryoFileID])

    Thanks.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    =DSUM("[ThawEmbThwd]","qryEmbThawFile","[CryoFileID]= " & [Forms]![frmActCCHEmb]![frmEmbCryoFile_Sub].[Form].[frmEmbThawFile_Csub].[Form]![txtCryoFileID])
    ...No "*" in what I posted. This does not work if the frmActCCHEmb form is not open.

  5. #5
    Tarl105 is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    7
    Thanks for your 10:45 AM reply RG.

    I entered the code exactly as illustrated...still no joy. Exactly the same error message.

    The frmActCCHEmb main form is open at the time that I attempt to enter this into the field's ControlSource.

    If I truncate the criteria expression, it works fine. It has something to do with that and I am at my wit's end.

    CryoFileID is present in the query feeding the subsubform and as a non-visible text field in the subsubform..[frmEmbThawFile_CSub].

    Any other ideas RG or are you deciding that I'm a lost cause? ;>)

    Whatever the outcome, thanks for being cordial enough to at least give it a look.

    Tarl105

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    It could be the depth of the nested SubForms. How about an invisible TextBox on the top most form (frmActCCHEmb) with a ControlSource of:
    =frmEmbCryoFile_Sub.Form.frmEmbThawFile_Csub.Form! txtCryoFileID
    ...but leave it visible until it works as you want then reference *that* control in your DSum() function.

  7. #7
    Tarl105 is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    7
    RG,

    I shall give that a try. It sounds better than anything else I have tried on my own! ;>)

    I will keep you posted.

    This mission will be hacked!!

    Tarl105

  8. #8
    Tarl105 is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    7
    RG,

    Interesting outcome of this adventure:
    In using your latest tip: =frmEmbCryoFile_Sub.Form.frmEmbThawFile_Csub.Form! txtCryoFileID in ta text box on the main form, I substituted txttotamt for txtCryoFileID and I noticed that the result that I was seeking...specifically, the total amount of a field in the subsubform....appeared in that textbox...without using DSUM!!!
    Still don't know why the DSUM construct didn't work but your solution gives me what I need just fine!!
    Must be that 8,300 foot Rocky Mountain air that gives you such a clear head!!
    Stay low and keep movin' RG and thanks!!!

    Tarl105

  9. #9
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Excellent! I'll admit the air *is* nice, as well as the stars (billions and billions I'd say). Are you ready to follow the link in my sig and mark this thread as Solved?

  10. #10
    Tarl105 is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    7
    RG,

    I would truly like to give you your props....IF I COULD GET ANYTHING OTHER THAN THE THREE DEFAULT OPTIONS ON THE ^%$#*@# Thread Tools pulldown!

    Kevin forwarded your message, with a link to the "Solved" image, which I followed. That's wher Mr. Murphy reared his ugly head and that's where I am now stuck!

    This cannot be that difficult but I seem to be doing a pretty good job of making it so!

    Where did I screw up?

  11. #11
    Tarl105 is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    7
    RG,

    As a follow-on to my last tirade. I finally stumbled onto the "Mark This Thread As Solved" key.

    I marked it as "Solved".

    Thanks again for your timely help. I was on the ledge.;>)

    Tarl105

  12. #12
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Ain't computers fun?

  13. #13
    Nasserhj is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2011
    Posts
    2
    Thank you for help

  14. #14
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Glad we could help.

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

Similar Threads

  1. HyperLink error "No Program registered ..."
    By RycherX in forum Access
    Replies: 1
    Last Post: 02-09-2010, 03:36 PM
  2. "Too many fields defined" error
    By Matthieu in forum Queries
    Replies: 1
    Last Post: 01-28-2010, 08:55 PM
  3. Error message and How do I find the "value Field" ?
    By createdwithfire in forum Forms
    Replies: 1
    Last Post: 11-05-2009, 12:26 PM
  4. Replies: 3
    Last Post: 05-30-2009, 12:30 PM
  5. "Type Mismatch" Error
    By elmousa68 in forum Access
    Replies: 2
    Last Post: 12-05-2006, 08:28 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