Insert Value into Table
-
- 4StarLounger
- Posts: 550
- Joined: 30 Jul 2014, 23:58
Insert Value into Table
I need to insert the Environ(UserName into PCUserName field in tblUser
-
- Administrator
- Posts: 78631
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Insert Value into Table
The following line will insert a new record in the table:
And this line will update the PCUserName field in the existing record(s):
Code: Select all
CurrentDb.Execute "INSERT INTO tblUser (PCUserName) VALUES ('" & Environ("username") & "')", dbFailOnError
Code: Select all
CurrentDb.Execute "UPDATE tblUser SET PCUserName='" & Environ("username") & "'", dbFailOnError
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 550
- Joined: 30 Jul 2014, 23:58
Re: Insert Value into Table
Thanks Hans. I'm hoping the rust comes off soon. Things I have forgotten how to do.
Appreciate it.
Appreciate it.