InFlight User Local time Tomorrow, 10:58 Joined Jun 11, 2015 Messages 130 Aug 8, 2019 #1 I am using VBA to change [myTableName]![myFieldName]!Required.Value = -1 I am getting error Error 2465 Can't find field '|1' referred to in your expression
I am using VBA to change [myTableName]![myFieldName]!Required.Value = -1 I am getting error Error 2465 Can't find field '|1' referred to in your expression
pbaldy Wino Moderator Staff member Local time Today, 15:58 Joined Aug 30, 2003 Messages 36,274 Aug 8, 2019 #2 What is your actual code? You can't just refer to a table like that.
InFlight User Local time Tomorrow, 10:58 Joined Jun 11, 2015 Messages 130 Aug 8, 2019 #3 Hi I think i may have got it by trial and error Is this correct Code: DoCmd.SetWarnings False db.TableDefs("Patronage").Fields("PatronageId").Required = True DoCmd.SetWarnings True
Hi I think i may have got it by trial and error Is this correct Code: DoCmd.SetWarnings False db.TableDefs("Patronage").Fields("PatronageId").Required = True DoCmd.SetWarnings True
pbaldy Wino Moderator Staff member Local time Today, 15:58 Joined Aug 30, 2003 Messages 36,274 Aug 8, 2019 #4 If it works, it's correct. You haven't declared or set the db variable. You can probably use CurrentDb instead, and you don't need the SetWarnings lines (I don't think anyway).
If it works, it's correct. You haven't declared or set the db variable. You can probably use CurrentDb instead, and you don't need the SetWarnings lines (I don't think anyway).
InFlight User Local time Tomorrow, 10:58 Joined Jun 11, 2015 Messages 130 Aug 8, 2019 #5 Sorry about that. It is set earlier
pbaldy Wino Moderator Staff member Local time Today, 15:58 Joined Aug 30, 2003 Messages 36,274 Aug 8, 2019 #6 So did it work? Say hi to my daughter!
InFlight User Local time Tomorrow, 10:58 Joined Jun 11, 2015 Messages 130 Aug 8, 2019 #7 Yes it did.Thanks I am still learning. Cheers
pbaldy Wino Moderator Staff member Local time Today, 15:58 Joined Aug 30, 2003 Messages 36,274 Aug 8, 2019 #8 No problem.
P Pat Hartman Super Moderator Staff member Local time Today, 18:58 Joined Feb 19, 2002 Messages 48,006 Aug 9, 2019 #9 DoCmd.SetWarnings False db.TableDefs("Patronage").Fields("PatronageId").Required = True DoCmd.SetWarnings True Click to expand... I'm not sure what this might be doing but it isn't an update query. Are you trying to set the required property of a field to true?
DoCmd.SetWarnings False db.TableDefs("Patronage").Fields("PatronageId").Required = True DoCmd.SetWarnings True Click to expand... I'm not sure what this might be doing but it isn't an update query. Are you trying to set the required property of a field to true?
pbaldy Wino Moderator Staff member Local time Today, 15:58 Joined Aug 30, 2003 Messages 36,274 Aug 9, 2019 #10 It does set the required property to true, yes.
P Pat Hartman Super Moderator Staff member Local time Today, 18:58 Joined Feb 19, 2002 Messages 48,006 Aug 9, 2019 #11 It was the .Value reference that confused me.
pbaldy Wino Moderator Staff member Local time Today, 15:58 Joined Aug 30, 2003 Messages 36,274 Aug 9, 2019 #12 Post 3 didn't clarify it?
M Mark_ Longboard on the internet Local time Today, 15:58 Joined Sep 12, 2017 Messages 2,457 Aug 12, 2019 #13 Odd question, why are you setting it as required at the table level by code instead of simply updating the table definition?
Odd question, why are you setting it as required at the table level by code instead of simply updating the table definition?
InFlight User Local time Tomorrow, 10:58 Joined Jun 11, 2015 Messages 130 Aug 12, 2019 #14 not to me.