Docmd.openform syntax

pdvsa
pdvsa used Ask the Experts™
on
Experts, there is an error in the Where condition.  I have tried many different versions with or without brackets, periods instead of !  but still give me an error.  Is the where condition correct?  

 DoCmd.OpenForm "frmRatingHistoryMoody", acFormDS, , "[EndUserID]= " & Me!EndUserID, acDialog

thank you
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Expert of the Quarter 2010
Expert of the Year 2010
Commented:
DoCmd.OpenForm "frmRatingHistoryMoody", acFormDS, , "[EndUserID]= " & Me!EndUserID,, acDialog

missing a comma
Expert of the Quarter 2010
Expert of the Year 2010

Commented:
Clearer if you wrote the param names

DoCmd.OpenForm FormName:="frmRatingHistoryMoody", View:=acFormDS, WhereCondition:="[EndUserID]="  & Me!EndUserID, WindowMode:=acDialog
Top Expert 2016
Commented:
is enduserId  a NUmber data

DoCmd.OpenForm "frmRatingHistoryMoody", acFormDS, , "[EndUserID]= " & Me!EndUserID, , acDialog


if text

DoCmd.OpenForm "frmRatingHistoryMoody", acFormDS, , "[EndUserID]= '" & Me!EndUserID & "'", , acDialog
pdvsaProject finance

Author

Commented:
It was text so I used Cap's suggestion but I did not state it was text so that might have been why cyberkiwi did not give a text answer.  Cap covered it all.  thank you
Me!EndUserID prob should be me.enduserID
if enduserid is a field on your form

use a period instead of an exclamation point.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial