A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

RunTime Error 3134



 
 
Thread Tools Display Modes
  #21  
Old May 29th, 2007, 06:37 PM posted to microsoft.public.access.forms
ajhome
external usenet poster
 
Posts: 39
Default RunTime Error 3134

Hi,

I inserted a message box, and it worked. However, the code still didn't do
anything.

"Douglas J. Steele" wrote:

Is the code executing? If you look at the On Click property of the form,
does it say [Event Procedure]? If not, correct that. If it does, try putting
a breakpoint in your code to see whether it runs (or a message box)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"ajhome" wrote in message
...
Hello Douglas,

Thank you for your help. I have entered the code just as you have said.
However, it still doesn't work. I am not getting an error message, it
just
doesn't do anything. It acts as if the button doesn't have any coding
behind
it.

"Douglas J. Steele" wrote:

If they're text fields, you need quotes around them, just as you have for
the CurrentUser field.

CurrentDb.Execute "INSERT INTO tblMovement " & _
"(EmpID, InsertDate, EffectiveDate, CurrentUser, " & _
"NewSupervisor, NewTitle, NewCenter) " & _
"VALUES (" & lstSelectEmp.Column(0) & ", " & _
Format(txtInsertDate, "\#yyyy\-mm\-dd\#") & _
"," & Format(txtEffectiveDate, "\#yyyy\-mm\-dd\#") & ", " & _
Chr$(34) & txtCurrent & Chr$(34) & ", " & _
Chr$(34) & cboNewSupervisor & Chr$(34) & ", " & _
Chr$(34) & cboNewTitle & Chr$(34) & ", " & _
Chr$(34) & cboNewCenter & Chr$(34) & ")"


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"ajhome" wrote in message
...
Hello,
Would someone please tell me what is wrong with this code:
CurrentDb.Execute "INSERT INTO tblMovement (EmpID, InsertDate,
EffectiveDate, CurrentUser, NewSupervisor, NewTitle, NewCenter) " & _
"VALUES (" & lstSelectEmp.Column(0) & ", " & Format(txtInsertDate,
"\#yyyy\-mm\-dd\#") & _
"," & Format(txtEffectiveDate, "\#yyyy\-mm\-dd\#") & ", " & Chr$(34)
&
txtCurrent & Chr$(34) & ", " & cboNewSupervisor & _
", " & cboNewTitle & ", " & cboNewCenter & ")"

The last 3 fields are text fields. When I put quotes around them, it
gives
me an error message of too few fields.

Thanks,
AJ






  #22  
Old May 29th, 2007, 07:24 PM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default RunTime Error 3134

Try changing to:

Dim strSQL As String

strSQL = "INSERT INTO tblMovement " & _
"(EmpID, InsertDate, EffectiveDate, CurrentUser, " & _
"NewSupervisor, NewTitle, NewCenter) " & _
"VALUES (" & lstSelectEmp.Column(0) & ", " & _
Format(txtInsertDate, "\#yyyy\-mm\-dd\#") & _
"," & Format(txtEffectiveDate, "\#yyyy\-mm\-dd\#") & ", " & _
Chr$(34) & txtCurrent & Chr$(34) & ", " & _
Chr$(34) & cboNewSupervisor & Chr$(34) & ", " & _
Chr$(34) & cboNewTitle & Chr$(34) & ", " & _
Chr$(34) & cboNewCenter & Chr$(34) & ")"

Debug.Print strSQL

CurrentDb.Execute strSQL, dbFailOnError

When the code runs, go to the Immediate Window (Ctrl-G) and look at the SQL
string that was written there. Does it look correct? What happens if you
create a query, paste that same SQL into it and run it?

Does adding the dbFailOnError parameter cause any meaning error to be
raised?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"ajhome" wrote in message
...
Hi,

I inserted a message box, and it worked. However, the code still didn't
do
anything.

"Douglas J. Steele" wrote:

Is the code executing? If you look at the On Click property of the form,
does it say [Event Procedure]? If not, correct that. If it does, try
putting
a breakpoint in your code to see whether it runs (or a message box)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"ajhome" wrote in message
...
Hello Douglas,

Thank you for your help. I have entered the code just as you have
said.
However, it still doesn't work. I am not getting an error message, it
just
doesn't do anything. It acts as if the button doesn't have any coding
behind
it.

"Douglas J. Steele" wrote:

If they're text fields, you need quotes around them, just as you have
for
the CurrentUser field.

CurrentDb.Execute "INSERT INTO tblMovement " & _
"(EmpID, InsertDate, EffectiveDate, CurrentUser, " & _
"NewSupervisor, NewTitle, NewCenter) " & _
"VALUES (" & lstSelectEmp.Column(0) & ", " & _
Format(txtInsertDate, "\#yyyy\-mm\-dd\#") & _
"," & Format(txtEffectiveDate, "\#yyyy\-mm\-dd\#") & ", " & _
Chr$(34) & txtCurrent & Chr$(34) & ", " & _
Chr$(34) & cboNewSupervisor & Chr$(34) & ", " & _
Chr$(34) & cboNewTitle & Chr$(34) & ", " & _
Chr$(34) & cboNewCenter & Chr$(34) & ")"


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"ajhome" wrote in message
...
Hello,
Would someone please tell me what is wrong with this code:
CurrentDb.Execute "INSERT INTO tblMovement (EmpID, InsertDate,
EffectiveDate, CurrentUser, NewSupervisor, NewTitle, NewCenter) " &
_
"VALUES (" & lstSelectEmp.Column(0) & ", " & Format(txtInsertDate,
"\#yyyy\-mm\-dd\#") & _
"," & Format(txtEffectiveDate, "\#yyyy\-mm\-dd\#") & ", " &
Chr$(34)
&
txtCurrent & Chr$(34) & ", " & cboNewSupervisor & _
", " & cboNewTitle & ", " & cboNewCenter & ")"

The last 3 fields are text fields. When I put quotes around them,
it
gives
me an error message of too few fields.

Thanks,
AJ








  #23  
Old May 30th, 2007, 12:12 PM posted to microsoft.public.access.forms
ajhome
external usenet poster
 
Posts: 39
Default RunTime Error 3134

Good Morning,

It tells me the following message:
"The INSERT INTO statement contains the following unknown field name:
'NewSupervisor'.

When I take that field out, I get the same error message for the other
fields as well. I have doubled checked my form and table to make sure that I
have spelled everything correctly and the same, and I have. What else could
be causing that error?

"Douglas J. Steele" wrote:

Try changing to:

Dim strSQL As String

strSQL = "INSERT INTO tblMovement " & _
"(EmpID, InsertDate, EffectiveDate, CurrentUser, " & _
"NewSupervisor, NewTitle, NewCenter) " & _
"VALUES (" & lstSelectEmp.Column(0) & ", " & _
Format(txtInsertDate, "\#yyyy\-mm\-dd\#") & _
"," & Format(txtEffectiveDate, "\#yyyy\-mm\-dd\#") & ", " & _
Chr$(34) & txtCurrent & Chr$(34) & ", " & _
Chr$(34) & cboNewSupervisor & Chr$(34) & ", " & _
Chr$(34) & cboNewTitle & Chr$(34) & ", " & _
Chr$(34) & cboNewCenter & Chr$(34) & ")"

Debug.Print strSQL

CurrentDb.Execute strSQL, dbFailOnError

When the code runs, go to the Immediate Window (Ctrl-G) and look at the SQL
string that was written there. Does it look correct? What happens if you
create a query, paste that same SQL into it and run it?

Does adding the dbFailOnError parameter cause any meaning error to be
raised?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



  #24  
Old May 30th, 2007, 01:19 PM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default RunTime Error 3134

One possibility is your field CurrentUser: that's a reserved word, and so
can lead to problems. (For a great discussion on what names to avoid in
Access, see what Allen Browne has at
http://www.allenbrowne.com/Ap****ueBadWord.html)

For now, try enclosing it in square brackets

strSQL = "INSERT INTO tblMovement " & _
"(EmpID, InsertDate, EffectiveDate, [CurrentUser], " & _
"NewSupervisor, NewTitle, NewCenter) " & _
etc

If that solves the issue, consider renaming the field (even though that's a
lot of work...)


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"ajhome" wrote in message
...
Good Morning,

It tells me the following message:
"The INSERT INTO statement contains the following unknown field name:
'NewSupervisor'.

When I take that field out, I get the same error message for the other
fields as well. I have doubled checked my form and table to make sure
that I
have spelled everything correctly and the same, and I have. What else
could
be causing that error?

"Douglas J. Steele" wrote:

Try changing to:

Dim strSQL As String

strSQL = "INSERT INTO tblMovement " & _
"(EmpID, InsertDate, EffectiveDate, CurrentUser, " & _
"NewSupervisor, NewTitle, NewCenter) " & _
"VALUES (" & lstSelectEmp.Column(0) & ", " & _
Format(txtInsertDate, "\#yyyy\-mm\-dd\#") & _
"," & Format(txtEffectiveDate, "\#yyyy\-mm\-dd\#") & ", " & _
Chr$(34) & txtCurrent & Chr$(34) & ", " & _
Chr$(34) & cboNewSupervisor & Chr$(34) & ", " & _
Chr$(34) & cboNewTitle & Chr$(34) & ", " & _
Chr$(34) & cboNewCenter & Chr$(34) & ")"

Debug.Print strSQL

CurrentDb.Execute strSQL, dbFailOnError

When the code runs, go to the Immediate Window (Ctrl-G) and look at the
SQL
string that was written there. Does it look correct? What happens if you
create a query, paste that same SQL into it and run it?

Does adding the dbFailOnError parameter cause any meaning error to be
raised?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)





  #25  
Old May 30th, 2007, 02:58 PM posted to microsoft.public.access.forms
ajhome
external usenet poster
 
Posts: 39
Default RunTime Error 3134

I tried, and it still didn't work. I have also changed that field name to
logon.

"Douglas J. Steele" wrote:

One possibility is your field CurrentUser: that's a reserved word, and so
can lead to problems. (For a great discussion on what names to avoid in
Access, see what Allen Browne has at
http://www.allenbrowne.com/Ap****ueBadWord.html)

For now, try enclosing it in square brackets

strSQL = "INSERT INTO tblMovement " & _
"(EmpID, InsertDate, EffectiveDate, [CurrentUser], " & _
"NewSupervisor, NewTitle, NewCenter) " & _
etc

If that solves the issue, consider renaming the field (even though that's a
lot of work...)


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"ajhome" wrote in message
...
Good Morning,

It tells me the following message:
"The INSERT INTO statement contains the following unknown field name:
'NewSupervisor'.

When I take that field out, I get the same error message for the other
fields as well. I have doubled checked my form and table to make sure
that I
have spelled everything correctly and the same, and I have. What else
could
be causing that error?

"Douglas J. Steele" wrote:

Try changing to:

Dim strSQL As String

strSQL = "INSERT INTO tblMovement " & _
"(EmpID, InsertDate, EffectiveDate, CurrentUser, " & _
"NewSupervisor, NewTitle, NewCenter) " & _
"VALUES (" & lstSelectEmp.Column(0) & ", " & _
Format(txtInsertDate, "\#yyyy\-mm\-dd\#") & _
"," & Format(txtEffectiveDate, "\#yyyy\-mm\-dd\#") & ", " & _
Chr$(34) & txtCurrent & Chr$(34) & ", " & _
Chr$(34) & cboNewSupervisor & Chr$(34) & ", " & _
Chr$(34) & cboNewTitle & Chr$(34) & ", " & _
Chr$(34) & cboNewCenter & Chr$(34) & ")"

Debug.Print strSQL

CurrentDb.Execute strSQL, dbFailOnError

When the code runs, go to the Immediate Window (Ctrl-G) and look at the
SQL
string that was written there. Does it look correct? What happens if you
create a query, paste that same SQL into it and run it?

Does adding the dbFailOnError parameter cause any meaning error to be
raised?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)






  #26  
Old May 30th, 2007, 05:08 PM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default RunTime Error 3134

What are the fields in your tblMovement table?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"ajhome" wrote in message
...
I tried, and it still didn't work. I have also changed that field name to
logon.

"Douglas J. Steele" wrote:

One possibility is your field CurrentUser: that's a reserved word, and so
can lead to problems. (For a great discussion on what names to avoid in
Access, see what Allen Browne has at
http://www.allenbrowne.com/Ap****ueBadWord.html)

For now, try enclosing it in square brackets

strSQL = "INSERT INTO tblMovement " & _
"(EmpID, InsertDate, EffectiveDate, [CurrentUser], " & _
"NewSupervisor, NewTitle, NewCenter) " & _
etc

If that solves the issue, consider renaming the field (even though that's
a
lot of work...)


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"ajhome" wrote in message
...
Good Morning,

It tells me the following message:
"The INSERT INTO statement contains the following unknown field name:
'NewSupervisor'.

When I take that field out, I get the same error message for the other
fields as well. I have doubled checked my form and table to make sure
that I
have spelled everything correctly and the same, and I have. What else
could
be causing that error?

"Douglas J. Steele" wrote:

Try changing to:

Dim strSQL As String

strSQL = "INSERT INTO tblMovement " & _
"(EmpID, InsertDate, EffectiveDate, CurrentUser, " & _
"NewSupervisor, NewTitle, NewCenter) " & _
"VALUES (" & lstSelectEmp.Column(0) & ", " & _
Format(txtInsertDate, "\#yyyy\-mm\-dd\#") & _
"," & Format(txtEffectiveDate, "\#yyyy\-mm\-dd\#") & ", " & _
Chr$(34) & txtCurrent & Chr$(34) & ", " & _
Chr$(34) & cboNewSupervisor & Chr$(34) & ", " & _
Chr$(34) & cboNewTitle & Chr$(34) & ", " & _
Chr$(34) & cboNewCenter & Chr$(34) & ")"

Debug.Print strSQL

CurrentDb.Execute strSQL, dbFailOnError

When the code runs, go to the Immediate Window (Ctrl-G) and look at
the
SQL
string that was written there. Does it look correct? What happens if
you
create a query, paste that same SQL into it and run it?

Does adding the dbFailOnError parameter cause any meaning error to be
raised?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)








 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:45 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.