Required.Value

InFlight

User
Local time
Today, 11:08
Joined
Jun 11, 2015
Messages
130
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
 
What is your actual code? You can't just refer to a table like that.
 
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
 
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).
 
So did it work?

Say hi to my daughter!
 
DoCmd.SetWarnings False
db.TableDefs("Patronage").Fields("PatronageId").Required = True
DoCmd.SetWarnings True
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?
 
It does set the required property to true, yes.
 
It was the .Value reference that confused me.
 
Post 3 didn't clarify it? ;)
 
Odd question, why are you setting it as required at the table level by code instead of simply updating the table definition?
 

Users who are viewing this thread

Back
Top Bottom