I have one store procedure for this job:
create proc userNT as
-- declaramos las variables
declare @name varchar(30), @lenindex int, @lenall int, @nomeuser varchar(10)
-- devuelve el nombre de usuario que entro
select @name= suser_sname()
select @lenall = len(@name)
select @lenindex = CHARINDEX('\',@name)
-- limpiamos las variables y tenemos el nombre
select substring (@name, @lenindex+1,@lenall-@lenindex) as ntusername
return
thos works but i dont know how to asign this to a control , i have try this
but not work
Private Sub user1_Click()
Dim pum, sql As String
sql = "exec usernt"
pum=DoCmd.RunSQL sql
End Sub
what is wron in this code???
Anand said:
Dear Alejandro,
You can achieve this by writing code in the OnClick event of the command button.
You can have a text box on the same form as the command button. Set the
control source of the text box to the relevant field in your log table.
Then enter in the on click event of the command button.