Hello,
I'm trying to create a general module, that i can use in different databases.
The problem now is that vba doesn't look at the value of the variables (tablename, user, computer, InOut), but sees the name of the variable as the fieldname:
ex.: call flogin("tbllogin","logname","logpc","logtype","LogIn")
In my recordset vba sees "rslogin!user" as "rslogin!user", but i want it to work with it as "rslogin!logname", the fieldname i give in my call.
The same problem with the other fiels (logpc, logtype).
How can i do this?
Any help appreciated.
Frank
I'm trying to create a general module, that i can use in different databases.
Sub FLogin(tablename, user, computer, InOut, type)
Dim rslogin As DAO.Recordset
Set rslogin = CurrentDb.OpenRecordset(tablename, dbOpenDynaset)
rslogin.AddNew
rslogin!user = fOSUserName()
rslogin!computer = fOSMachineName()
rslogin!InOut = type
rslogin.update
rslogin.close
End sub
Dim rslogin As DAO.Recordset
Set rslogin = CurrentDb.OpenRecordset(tablename, dbOpenDynaset)
rslogin.AddNew
rslogin!user = fOSUserName()
rslogin!computer = fOSMachineName()
rslogin!InOut = type
rslogin.update
rslogin.close
End sub
The problem now is that vba doesn't look at the value of the variables (tablename, user, computer, InOut), but sees the name of the variable as the fieldname:
ex.: call flogin("tbllogin","logname","logpc","logtype","LogIn")
In my recordset vba sees "rslogin!user" as "rslogin!user", but i want it to work with it as "rslogin!logname", the fieldname i give in my call.
The same problem with the other fiels (logpc, logtype).
How can i do this?
Any help appreciated.
Frank