I am an absolute begineer in MS Access. Will try to put my question as simply n clearly as possible.
I have designed a database to keep history of our company's projects. The 'Master Project History Table' contains fields including 'Project Ref', 'Project Title', 'Project Budget' and 'Project Year'. The users are expected to populate the table through 'Master Project HistoryForm'.
The key field is set as 'Project Ref'.
Some of the projects are combined with each other and to display this info, 'Master Project History Form' also has the fields 'Project Ref-1', 'Project Title-1', 'Project Budget-1' and 'Project Year-1'.
I want a code for the ('On Update' event) that will fetch and display data in 'Project Title-1', 'Project Budget-1' and 'Project Year-1' fields when 'Project Ref-1' is updated. Please note that all this info is coming from the same 'Master Project History Table'.
My IT guys told me to use a code with variable for each field that goes something like this (to update Project Title-1 field):
Dim varX As Variant
varX = DLookup("[Project Title]" , "Master Project History Table" , "[Project Ref]=" & Forms![Master Project History Form]![Project Ref-1])
Me![Project Title-1] = varX
And then repeat for each other field by defining new variables.
The above is not working giveing syntex errors etc.
Will appreciate help from fellow members.
I have designed a database to keep history of our company's projects. The 'Master Project History Table' contains fields including 'Project Ref', 'Project Title', 'Project Budget' and 'Project Year'. The users are expected to populate the table through 'Master Project HistoryForm'.
The key field is set as 'Project Ref'.
Some of the projects are combined with each other and to display this info, 'Master Project History Form' also has the fields 'Project Ref-1', 'Project Title-1', 'Project Budget-1' and 'Project Year-1'.
I want a code for the ('On Update' event) that will fetch and display data in 'Project Title-1', 'Project Budget-1' and 'Project Year-1' fields when 'Project Ref-1' is updated. Please note that all this info is coming from the same 'Master Project History Table'.
My IT guys told me to use a code with variable for each field that goes something like this (to update Project Title-1 field):
Dim varX As Variant
varX = DLookup("[Project Title]" , "Master Project History Table" , "[Project Ref]=" & Forms![Master Project History Form]![Project Ref-1])
Me![Project Title-1] = varX
And then repeat for each other field by defining new variables.
The above is not working giveing syntex errors etc.
Will appreciate help from fellow members.