Pete Printer
Registered User.
- Local time
 - Today, 04:22
 
- Joined
 - Jul 28, 2014
 
- Messages
 - 15
 
Hi
This code works fine and inserts the 3 values into the table.
	
	
	
		
However i need to replace the TestData value with the current user details.
i created a Variable BookedBy as string and set it thus.
	
	
	
		
The variable is set fine
i have tried replacing TestData with BookedBy and this throws error end of statement required.
Samething happens when i try
	
	
	
		
Thanks for looking at this.:banghead:
Pete
 This code works fine and inserts the 3 values into the table.
		Code:
	
	
	DoCmd.RunSQL "INSERT INTO JobsStaffAvail ( tblJobsID, tblStaffAvailID, bookedBy )" _
    & "VALUES(Forms!frmbookstafftojob.JobsID ,Forms!frmbookstafftojob.subfrmStaffAvail.Form.staffid ,'TestData')"
	However i need to replace the TestData value with the current user details.
i created a Variable BookedBy as string and set it thus.
		Code:
	
	
	BookedBy = Environ$("username")
	The variable is set fine
i have tried replacing TestData with BookedBy and this throws error end of statement required.
Samething happens when i try
		Code:
	
	
	 '(Environ$("username"))'
	Thanks for looking at this.:banghead:
Pete