Using LIKE with a function
My function is:
Public Function User()
User = VBA.Environ("UserName") End Function
And my query is:
SELECT tbl_REF_Reminder.Type, tbl_REF_Reminder.PIC, tbl_REF_RMOPIC.[UN Code], tbl_REF_RMOPIC.[AG Code], tbl_REF_Reminder.Agent, tbl_REF_Reminder.DueDate, tbl_REF_Reminder.RemindStatus, tbl_REF_UID.UserID, tbl_REF_RMOPIC.[Agency Name] AS Agency
FROM (tbl_REF_Reminder INNER JOIN tbl_REF_RMOPIC ON tbl_REF_Reminder.Agent = tbl_REF_RMOPIC.[UN Code]) INNER JOIN tbl_REF_UID ON tbl_REF_RMOPIC.[PIC Name] = tbl_REF_UID.Name WHERE (((tbl_REF_Reminder.PIC) Like User()) AND ((tbl_REF_Reminder.DueDate) Between Format(Now()-2,'dd/mm/yyyy') And Format(Now(),'dd/mm/yyyy')) AND ((tbl_REF_Reminder.RemindStatus)=-1));
When I try as per above I get no results. If I add *User()* I get an invalid operator error.
I need to use LIKE as there may be multiple users in the PIC field
Thank you for taking the time to report an issue.
What's wrong... Please write below.
Public Function Foo()
On Error GoTo er
'Code goes here.
ex: 'Cleanup code, closing open objects, etc.
erf 'An error handling function, which writes this function's name
'and error stats to a table, then returns here.
MsgBox Err.Description 'Allows stepping through code in this function.
Resume ex 'Gets cleanup code.
The only issue I'm having is having to pass the current function name in to my error handler. Does anyone know a way to get this systematically
Sub Chk1_AfterUpdate() Function End Sub Sub Chk2_AfterUpdate() Function End Sub
Could I have something like
Sub Chk1 through Chk10_AfterUpdate() Function End Sub
ADD = function
Number1 & Number2 = parameters specific to the function
Add (5,3) = function call
where the numbers 5 and 3 are parameters specific to the function call
What I would like is a datamodel that can do this: if I add a new function, it should present me with the parameters specific for that function, but the values for those parameters should be different for each 'function call'. I'm really struggeling with this one and I'm in need of some
Can I take ownership of the above function?
I understand this is a function Access "owns" or am I
Nearly all of our problems would be resolved if I can get into this function and have it look to the new login Form I will create to get the CurrentUser() rather then the mdw file I assume it currently looks for.
If I can't do this then I must seach for all references to this function and replace same with a new function I create say, =TeamMemberLogged
I have created a Function to perform a task (delete records) and want this to be actioned within another function.
How do I get this to happen ? DoCmd ?
Here is an extract of the main procedure and the function I want to get to work is FuncDeleteRecord(some variables)
If RepayFreq = "Fortnightly" Then
'FuncDeleteRecord("TblLateFeeCalculated", "LDPK", "LoanID")
Do Until Date <= CommenceDate
Appreciate any advice
I have referenced a control on a form from a function in a module using this:
The function looks like this:
Function(frm as form, ctl as control)
The function call looks like this:
Call Function(me, me.ctl)
This all works fine but I cannot work out how to do the same thing except referencing the control in a subform, i.e. what do you pass to the function and how do you reference it in the function?
I have tried everything I can think of, stuff like.
and passing it like this.
Call Function(me.parent, me, me.ctl)
Function(frmParent as form, frmSubform as form, ctl as control)
Public Function Clrclct(clct As Collection)
For I = 1 To clct.Count
I can only add that it's later being used while exporting tables from access to excel.
When I create a macro and use RunCode and run the macro, I get the error
The expression you entered has a function name that Microsoft Access can't find.
If I change the function name to CQs() and enter that in the macro, then it's fine.