
Converted macro doesn't work in runtime.
Hi,
This is my second posting so I hope someone can answer this.
To use error handling I converted the following macros. In order to use the
following on the toolbar I create another macro that uses runcode. In the
following it is set to run the function import(). This works fine. However,
when I make a runtime version this no longer works. However, if I make a
form with a command button with the onclick event set to
(DoCmd.TransferText acImportDelim, "import", "clients", "c:\1.txt", false,
"") it works. Any clues as to why this happens are appreciated.
Example:
function import()
DoCmd.TransferText acImportDelim, "import", "clients", "c:\1.txt",
False, ""
end function
I have the same problem with a macro I lifted from Northwind DB.to use as a
lastname
filter. It looks like this:
Function Last_Name_Filter_Alpha_Buttons()
On Error GoTo Last_Name_Filter_Alpha_Buttons_Err
With CodeContextObject
' Attached to AfterUpdate event of CompanyNameFilter option group.
If (.LastNameFilters = 1) Then
' Filter for company names that start with A, , , ?, ?, or ?.
DoCmd.ApplyFilter "", "[LastName] Like ""[A???]*"""
End If
If (.LastNameFilters = 2) Then
' B
DoCmd.ApplyFilter "", "[lastName] Like ""B*"""
..........
Thanks. Much appreciated.
Alan Schwartz