Saturday, September 13, 2008

File and Folder Dialogs: Even More Sophistication

Here's another version of "how do I prompt the user for a folder name/file name? This one adds additional sophistication. On the folder dialog you can pre-select a folder. On the file dialog you can specify the X and Y coordinates for the dialog box. It's at

See also How to display and to use the File dialog box in Microsoft Access (Oct 2007).

1 comment: said...

I have a combo called Subfunction which i have populated based on a query with 3 columns. i just show 1 column. When there is a change here i want to load the cmb_RetFtr with values based on the selection in Subfunction. This requires i retrieve the hidden fields and parametrize the query.

It works the first time. i can retrieve the combo recordset. However on the second change it says "object is invalid or doesn't exit. Can you help me resolve it ?

Dim nTypeId As Integer
Dim sSql As String
Dim rsCmdData As DAO.Recordset

What's wrong with the code below ?
Set rsCmdData = Me.cmb_SubFunction.Recordset
If rsCmdData.RecordCount <> 0 Then
nTypeId = rsCmdData.Fields(1)
End If

sSql = "SELECT distinct RuleTable.[RET/FTR Range], RuleTable.TypeId, RuleTable.ContextId FROM RuleTable" _
& " WHERE (((RuleTable.TypeId)=" & nTypeId & "))"

Me.cmb_RetFtr.Enabled = True
Me.cmb_RetFtr.RowSource = sSql
Me.cmb_RetFtr.BoundColumn = 1
Me.cmb_RetFtr.ColumnCount = 3
Me.cmb_RetFtr.ColumnWidths = "2 in;0;0"
Me.cmb_RetFtr = Me.cmb_RetFtr.ItemData(0)