Run-time error 3075

  • Thread starter Thread starter Thunder Thumb
  • Start date Start date
T

Thunder Thumb

I keep getting the above error message when I try to insert a record into the
related table.

My coding reads

Me.txtIncident = Me.txtDescriptionScript & Me.txtUpdateScript

Me.txtIncident.SetFocus

Username = Environ("USERNAME")

DoCmd.RunSQL ("INSERT INTO tblIncidents ([DescriptionScript]) VALUES ('" &
Me.txtIncident.Text & "')")

I've merged two fields to make the data more meaningful. But at run time it
falls over with the error message missing operator.

Can somebody help please!!!!
 
Thunder Thumb said:
Username = Environ("USERNAME")

You should be using an API call instead of Environ to fetch the
username.

Changing the environment variable in the command prompt does not
affect other programs that you start from Windows. But only from
that particular command prompt.

However that 00.01% of the users that know about this could also be
the malicious users who want to blame data problems on other people.

Hmmm, being the sneaky bugger that I am I'd put a check in to compare
the value of the environment variable against the API call. If
different without an exceedingly good reason that'd be grounds to
terminate the employee.
DoCmd.RunSQL ("INSERT INTO tblIncidents ([DescriptionScript]) VALUES ('" &
Me.txtIncident.Text & "')")

Remove the .text from me.txtIncident as you can't use .text unless the
control has the focus. That may work in VB 6 and earlier but not in
Access.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
Back
Top