Forum Discussion
Source; table ACC; several tables, select one if exist, if not select the second... TRABL
- 5 years ago
let
Source = Excel.CurrentWorkbook(),
ActiveTable = (Source{[Name="Table1"]}? ?? Source{[Name="Table2"]}? ?? Source{[Name="Table3"]}?)[Content]
in
ActiveTable
Hi,
thank you, but I think that is not the reasult for my problem.
Part with Excel table works well, determine only name of Access db and path to it.
I have problem with determine name of the table in Access db.
For example:
In Access db can exist this tables 202104_offer ; _offer2021_all ; offer_all_backup
The best is open 202104_offer and don't try to open the others, but it may not exist.
If 202104_offer doesn't exist, try if exist _offer2021_all, if it exist, open it and stop trying open others, if it doesn't exist try open the offer_all_backup.
Offer_all_backup is allways exist, but it's really huge and openning it takes a very long time.
I need to modify this part:
Second_table = if (Second_tab)[HasError] = true then Thirt_table else Second_tab,
Thirt_table = if (Thirt_tab)[HasError] = true then Fourth_table else Thirt_tab,
Fourt_table = if (Fourth_tab)[HasError] = true then Error else Fourth_tab,
table = if (First_tab)[HasError] = true then Second_table else First_tab,
Partner = ACC{[Schema="",Item=table]}[Data],
in
Partner
Hi,
sorry it works well.
It need only modify to ACC table case:
....
Partner = (ACC{[Schema="", Item=First_tab]}? ?? ACC{[Schema="", Item=Second_tab]}? ?? ACC{[Schema="", Item=Last_tab]}?)[Data],
....