Update with Data Macro (1 Viewer)

ZEEq

Member
Local time
Today, 22:36
Joined
Sep 26, 2022
Messages
93
Hello Everyone
I have a question regarding Data Macro i want to change a field value in another table if PK exist i did something like this its working but need your opinion to improve the code
Screenshot (6).png
 

XPS35

Active member
Local time
Today, 19:36
Joined
Jul 19, 2022
Messages
160
I wonder if you really need the field you're updating. If you can deduce the value from other values or conditions, then we are dealing with a derivable data and that should not be stored. This makes the code superfluous.
 

ZEEq

Member
Local time
Today, 22:36
Joined
Sep 26, 2022
Messages
93
I wonder if you really need the field you're updating. If you can deduce the value from other values or conditions, then we are dealing with a derivable data and that should not be stored. This makes the code superfluous.
thanks for your reply can you explain your point in details please
 

XPS35

Active member
Local time
Today, 19:36
Joined
Jul 19, 2022
Messages
160
Perhaps you should first explain a bit more about the purpose of your database and the meaning of the fields. Then maybe I can explain more precisely what I mean.
 

ZEEq

Member
Local time
Today, 22:36
Joined
Sep 26, 2022
Messages
93
Perhaps you should first explain a bit more about the purpose of your database and the meaning of the fields. Then maybe I can explain more precisely what I mean.
this is student Fee Management Database that i have been working on
1.StudentFeeDueT ( this table contain monthly Invoices of students and it has additional discount field)
2.studentAdditionalDiscountT (this table contains Discounts related with that student )
if StudentFeeDueT contain that Discount ID i want the flag to show this discount cannot be applied again
 
Last edited:

XPS35

Active member
Local time
Today, 19:36
Joined
Jul 19, 2022
Messages
160
So that's exactly what I mean. If you can deduce the value of the flag from the presence of a discount ID in a certain table, then that flag is superfluous. If you want to know somewhere in a process whether the discount can still be applied, you only have to check the ID. The danger of your construction is that inconsistencies can arise. So that the flag indicates something different than appears from the filling of the tables.
 

ZEEq

Member
Local time
Today, 22:36
Joined
Sep 26, 2022
Messages
93
So that's exactly what I mean. If you can deduce the value of the flag from the presence of a discount ID in a certain table, then that flag is superfluous. If you want to know somewhere in a process whether the discount can still be applied, you only have to check the ID. The danger of your construction is that inconsistencies can arise. So that the flag indicates something different than appears from the filling of the tables.
that means i need to make some changes to my database design
i will start new topic regarding design
thanks @XPS35
 

jdraw

Super Moderator
Staff member
Local time
Today, 13:36
Joined
Jan 23, 2006
Messages
15,385
I agree with Peter. I would also suggest you review your data model (tables and relationships) with some test data to ensure your set up accurately reflects your "business" and needs. See stump the model for more info.

You may also get some insight on data macros from this and the dialog in the thread.
 

Users who are viewing this thread

Top Bottom