Required.Value

InFlight

User
Local time
Tomorrow, 06:00
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!
 
It does set the required property to true, yes.
 
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