我有一個 MS Access 資料庫,它使用顯示表單屬性(在選項>當前資料庫下)在加載資料庫時自動打開一個表單。出于某種原因,今天當我更新了一些與顯示表單屬性無關的其他選項時,我得到了這個彈出視窗,每當我嘗試選擇一個新的顯示表單時,顯示表單都不會保存(下次我打開選項選單,顯示表單下拉選單沒有選擇)。有誰知道這里發生了什么,或者除了“選項”選單之外是否還有另一種設定“顯示表單”屬性的方法?提前致謝!

uj5u.com熱心網友回復:
除了“選項”選單之外,是否還有其他方法可以設定“顯示表單”屬性?
顯示表單設定存盤為名為"StartUpForm"的資料庫屬性。您可以使用 VBA 來管理該屬性。這是立即視窗中的一個示例。(您可以使用Ctrl g轉到“立即”視窗。)
' if the property currently exists, this should remove it;
' if it does not exist, this will trigger error 3265,
' "Item not found in this collection" --- just ignore the error
currentdb.Properties.Delete "StartUpForm"
' now create the property with the name for your display form; mine will be Form1
set prp = currentdb.CreateProperty("StartUpForm", dbText, "Form1")
' finally add the new property to the database properties collection
currentdb.Properties.Append prp
' if you want to verify your change was saved ...
? currentdb.Properties("StartUpForm").Value
Form1
當您無法通過訪問選項 UI 進行設定時,我不確定該方法是否能讓您成功設定顯示表單。但是,也許它會揭示一些有用的資訊來說明它失敗的原因。祝你好運。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/511677.html
