D
DaveInSAT
Thanks for any help.
Ofer said:Try and read the help about the active control
You can use the ActiveControl property together with the Screen object to
identify or refer to the control that has the focus. Read-only Control object.
Try and create a function that return the active control, and then you can
call this function from a query
Function GetActiveFieldName()
Dim ctlCurrentControl As Control
Set ctlCurrentControl = Forms![MyForm].ActiveControl
GetActiveFieldName = ctlCurrentControl.Name End Functio
DaveInSAT said:Thanks for any help.
DaveInSAT said:The Active Control is only applicable to in macros I thought, I'm trying to
refer to it within a query. Is this possible?
Thanks again.
David
Ofer said:Try and read the help about the active control
You can use the ActiveControl property together with the Screen object to
identify or refer to the control that has the focus. Read-only Control object.
Try and create a function that return the active control, and then you can
call this function from a query
Function GetActiveFieldName()
Dim ctlCurrentControl As Control
Set ctlCurrentControl = Forms![MyForm].ActiveControl
GetActiveFieldName = ctlCurrentControl.Name End Functio
DaveInSAT said:Thanks for any help.
Ofer said:Yes
follow this steps
1. Create a function in a module called GetActiveFieldName
Function GetActiveFieldName()
Dim ctlCurrentControl As Control
Set ctlCurrentControl = Forms![MyFormName].ActiveControl ' change the
form name
GetActiveFieldName = ctlCurrentControl.Name End Functio
End Function
2. create a query, and call the function and see that it returns the name of
the active field.
Select *, GetActiveFieldName() as activefield Form MyTable
Now the question is, what do you want to do with it, if you want the value
of the active field, then try this
forms)
Select *, forms)
as activefield Form MyTable
DaveInSAT said:The Active Control is only applicable to in macros I thought, I'm trying to
refer to it within a query. Is this possible?
Thanks again.
David
Ofer said:Try and read the help about the active control
You can use the ActiveControl property together with the Screen object to
identify or refer to the control that has the focus. Read-only Control object.
Try and create a function that return the active control, and then you can
call this function from a query
Function GetActiveFieldName()
Dim ctlCurrentControl As Control
Set ctlCurrentControl = Forms![MyForm].ActiveControl
GetActiveFieldName = ctlCurrentControl.Name End Functio
:
Thanks for any help.
Ofer said:Yes
follow this steps
1. Create a function in a module called GetActiveFieldName
Function GetActiveFieldName()
Dim ctlCurrentControl As Control
Set ctlCurrentControl = Forms![MyFormName].ActiveControl ' change the
form name
GetActiveFieldName = ctlCurrentControl.Name End Functio
End Function
2. create a query, and call the function and see that it returns the name of
the active field.
Select *, GetActiveFieldName() as activefield Form MyTable
Now the question is, what do you want to do with it, if you want the value
of the active field, then try this
forms)
Select *, forms)
as activefield Form MyTable
DaveInSAT said:The Active Control is only applicable to in macros I thought, I'm trying to
refer to it within a query. Is this possible?
Thanks again.
David
Ofer said:Try and read the help about the active control
You can use the ActiveControl property together with the Screen object to
identify or refer to the control that has the focus. Read-only Control object.
Try and create a function that return the active control, and then you can
call this function from a query
Function GetActiveFieldName()
Dim ctlCurrentControl As Control
Set ctlCurrentControl = Forms![MyForm].ActiveControl
GetActiveFieldName = ctlCurrentControl.Name End Functio
:
Thanks for any help.
DaveInSAT said:Ofer,
within the query get the error undefined function 'forms![frm XXX] in
expression.
the form is active -
what am i missing????
Many Thanks,
David
Ofer said:Yes
follow this steps
1. Create a function in a module called GetActiveFieldName
Function GetActiveFieldName()
Dim ctlCurrentControl As Control
Set ctlCurrentControl = Forms![MyFormName].ActiveControl ' change the
form name
GetActiveFieldName = ctlCurrentControl.Name End Functio
End Function
2. create a query, and call the function and see that it returns the name of
the active field.
Select *, GetActiveFieldName() as activefield Form MyTable
Now the question is, what do you want to do with it, if you want the value
of the active field, then try this
forms)
Select *, forms)
as activefield Form MyTable
DaveInSAT said:The Active Control is only applicable to in macros I thought, I'm trying to
refer to it within a query. Is this possible?
Thanks again.
David
:
Try and read the help about the active control
You can use the ActiveControl property together with the Screen object to
identify or refer to the control that has the focus. Read-only Control object.
Try and create a function that return the active control, and then you can
call this function from a query
Function GetActiveFieldName()
Dim ctlCurrentControl As Control
Set ctlCurrentControl = Forms![MyForm].ActiveControl
GetActiveFieldName = ctlCurrentControl.Name End Functio
:
Thanks for any help.
Ofer said:Please post the SQL, Form Name, And the function you created, which I assume
you created in a module and not under the form
DaveInSAT said:Ofer,
within the query get the error undefined function 'forms![frm XXX] in
expression.
the form is active -
what am i missing????
Many Thanks,
David
Ofer said:Yes
follow this steps
1. Create a function in a module called GetActiveFieldName
Function GetActiveFieldName()
Dim ctlCurrentControl As Control
Set ctlCurrentControl = Forms![MyFormName].ActiveControl ' change the
form name
GetActiveFieldName = ctlCurrentControl.Name End Functio
End Function
2. create a query, and call the function and see that it returns the name of
the active field.
Select *, GetActiveFieldName() as activefield Form MyTable
Now the question is, what do you want to do with it, if you want the value
of the active field, then try this
forms)
Select *, forms)
as activefield Form MyTable
:
The Active Control is only applicable to in macros I thought, I'm trying to
refer to it within a query. Is this possible?
Thanks again.
David
:
Try and read the help about the active control
You can use the ActiveControl property together with the Screen object to
identify or refer to the control that has the focus. Read-only Control object.
Try and create a function that return the active control, and then you can
call this function from a query
Function GetActiveFieldName()
Dim ctlCurrentControl As Control
Set ctlCurrentControl = Forms![MyForm].ActiveControl
GetActiveFieldName = ctlCurrentControl.Name End Functio
:
Thanks for any help.
DaveInSAT said:within a module as you suspected:
Public Function Dave()
Dim ctlCurrentControl As Control
Set ctlCurrentControl = Forms![frm Partner Deal information].ActiveControl
Dave = ctlCurrentControl.Name
End Function
within the query as a criteria :
forms)
form is open and the field is highlighted where i have the criteria above.
thanks
Ofer said:Please post the SQL, Form Name, And the function you created, which I assume
you created in a module and not under the form
DaveInSAT said:Ofer,
within the query get the error undefined function 'forms![frm XXX] in
expression.
the form is active -
what am i missing????
Many Thanks,
David
:
Yes
follow this steps
1. Create a function in a module called GetActiveFieldName
Function GetActiveFieldName()
Dim ctlCurrentControl As Control
Set ctlCurrentControl = Forms![MyFormName].ActiveControl ' change the
form name
GetActiveFieldName = ctlCurrentControl.Name End Functio
End Function
2. create a query, and call the function and see that it returns the name of
the active field.
Select *, GetActiveFieldName() as activefield Form MyTable
Now the question is, what do you want to do with it, if you want the value
of the active field, then try this
forms)
Select *, forms)
as activefield Form MyTable
:
The Active Control is only applicable to in macros I thought, I'm trying to
refer to it within a query. Is this possible?
Thanks again.
David
:
Try and read the help about the active control
You can use the ActiveControl property together with the Screen object to
identify or refer to the control that has the focus. Read-only Control object.
Try and create a function that return the active control, and then you can
call this function from a query
Function GetActiveFieldName()
Dim ctlCurrentControl As Control
Set ctlCurrentControl = Forms![MyForm].ActiveControl
GetActiveFieldName = ctlCurrentControl.Name End Functio
:
Thanks for any help.
DaveInSAT said:within a module as you suspected:
Public Function Dave()
Dim ctlCurrentControl As Control
Set ctlCurrentControl = Forms![frm Partner Deal information].ActiveControl
Dave = ctlCurrentControl.Name
End Function
within the query as a criteria :
forms)
form is open and the field is highlighted where i have the criteria above.
thanks
Ofer said:Please post the SQL, Form Name, And the function you created, which I assume
you created in a module and not under the form
DaveInSAT said:Ofer,
within the query get the error undefined function 'forms![frm XXX] in
expression.
the form is active -
what am i missing????
Many Thanks,
David
:
Yes
follow this steps
1. Create a function in a module called GetActiveFieldName
Function GetActiveFieldName()
Dim ctlCurrentControl As Control
Set ctlCurrentControl = Forms![MyFormName].ActiveControl ' change the
form name
GetActiveFieldName = ctlCurrentControl.Name End Functio
End Function
2. create a query, and call the function and see that it returns the name of
the active field.
Select *, GetActiveFieldName() as activefield Form MyTable
Now the question is, what do you want to do with it, if you want the value
of the active field, then try this
forms)
Select *, forms)
as activefield Form MyTable
:
The Active Control is only applicable to in macros I thought, I'm trying to
refer to it within a query. Is this possible?
Thanks again.
David
:
Try and read the help about the active control
You can use the ActiveControl property together with the Screen object to
identify or refer to the control that has the focus. Read-only Control object.
Try and create a function that return the active control, and then you can
call this function from a query
Function GetActiveFieldName()
Dim ctlCurrentControl As Control
Set ctlCurrentControl = Forms![MyForm].ActiveControl
GetActiveFieldName = ctlCurrentControl.Name End Functio
:
Thanks for any help.