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
  #1  
Old May 10th, 2007, 03:27 PM posted to microsoft.public.access.forms
ajhome
external usenet poster
 
Posts: 39
Default RunTime Error 3134

Greetings...

Could someone tell me what is wrong with this line of code?

CurrentDb.Execute "INSERT INTO tblExistCheckList (EmpID, SupervisorID,
ADID,)" & _
"VALUES (" & lstSelectEmp.Column(0) & ", " &
lstSelectEmp.Column(2) & ", " & lstSelectEmp.Column(4) & ")"

All of the ID fields are text fields.
  #2  
Old May 10th, 2007, 03:39 PM posted to microsoft.public.access.forms
ajhome
external usenet poster
 
Posts: 39
Default RunTime Error 3134

OK! Nevermind! I figured out I had an extra comma. However, I still need
help. I have a form that is populating a table. The code below is suppose
to add those 3 fields and the others in on the form. However, it is adding
the 3 fields from the code as a new record instead of with the other fields
on the form. Any suggestions?

Thanks,
AJ
  #3  
Old May 10th, 2007, 03:39 PM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default RunTime Error 3134

You've got a comma between ADID and the closing parenthesis. As well, since
the ID fields are text, you must put quotes around the values:

CurrentDb.Execute "INSERT INTO tblExistCheckList (EmpID, SupervisorID,
ADID) " & _
"VALUES ('" & lstSelectEmp.Column(0) & "', '" & lstSelectEmp.Column(2) &
"', '" & lstSelectEmp.Column(4) & "')"

Exagerated for clarity, that's

CurrentDb.Execute "INSERT INTO tblExistCheckList (EmpID, SupervisorID,
ADID) " & _
"VALUES ( ' " & lstSelectEmp.Column(0) & " ' , ' " &
lstSelectEmp.Column(2) & " ', ' " & lstSelectEmp.Column(4) & " ' )"

(apologies in advance for the line wrapping.)


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


"ajhome" wrote in message
...
Greetings...

Could someone tell me what is wrong with this line of code?

CurrentDb.Execute "INSERT INTO tblExistCheckList (EmpID, SupervisorID,
ADID,)" & _
"VALUES (" & lstSelectEmp.Column(0) & ", " &
lstSelectEmp.Column(2) & ", " & lstSelectEmp.Column(4) & ")"

All of the ID fields are text fields.



  #4  
Old May 10th, 2007, 03:54 PM posted to microsoft.public.access.forms
ajhome
external usenet poster
 
Posts: 39
Default RunTime Error 3134

Thanks! Maybe you could help me with my other problem! I have an unbound
form with a bound subform. When I try to insert fields into the current
record of the subform, it adds the fields as new records instead of the
current. How do I insert data into the current record?

Thanks,
AJ
  #5  
Old May 10th, 2007, 09:27 PM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default RunTime Error 3134

Realistically, it makes no sense to have a bound subform and an unbound
form. Subforms must be linked to the parent form, and you can't link unbound
forms.

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


"ajhome" wrote in message
...
Thanks! Maybe you could help me with my other problem! I have an unbound
form with a bound subform. When I try to insert fields into the current
record of the subform, it adds the fields as new records instead of the
current. How do I insert data into the current record?

Thanks,
AJ



  #6  
Old May 11th, 2007, 02:17 AM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default RunTime Error 3134

On Thu, 10 May 2007 16:27:46 -0400, "Douglas J. Steele"
wrote:

Realistically, it makes no sense to have a bound subform and an unbound
form. Subforms must be linked to the parent form, and you can't link unbound
forms.


Well, I hate to disagree Douglas, but this is actually a pretty handy
technique for lots of things. You CAN link a bound subform to a control in an
unbound mainform; you need to use the *control name* - not a fieldname - as
the Master Link field. It can be a handy way to give a quick filtered form.

John W. Vinson [MVP]
  #7  
Old May 11th, 2007, 12:29 PM posted to microsoft.public.access.forms
ajhome
external usenet poster
 
Posts: 39
Default RunTime Error 3134

Thank you both for your input! As part of the same form, I have an option
group (check boxes.) How do I insert whatever value my user selects into my
table?

Thanks,
AJ

"John W. Vinson" wrote:

On Thu, 10 May 2007 16:27:46 -0400, "Douglas J. Steele"
wrote:

Realistically, it makes no sense to have a bound subform and an unbound
form. Subforms must be linked to the parent form, and you can't link unbound
forms.


Well, I hate to disagree Douglas, but this is actually a pretty handy
technique for lots of things. You CAN link a bound subform to a control in an
unbound mainform; you need to use the *control name* - not a fieldname - as
the Master Link field. It can be a handy way to give a quick filtered form.

John W. Vinson [MVP]

  #8  
Old May 11th, 2007, 07:55 PM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default RunTime Error 3134

On Fri, 11 May 2007 04:29:01 -0700, ajhome
wrote:

Thank you both for your input! As part of the same form, I have an option
group (check boxes.) How do I insert whatever value my user selects into my
table?


An Option Group control has a single numeric value indicating which choice the
user made. What do you want inserted in your table? That number? A text string
based on the choice? or what?

John W. Vinson [MVP]
  #9  
Old May 14th, 2007, 12:42 PM posted to microsoft.public.access.forms
ajhome
external usenet poster
 
Posts: 39
Default RunTime Error 3134

Good Morning,

I want to be able to insert the number or a text string based on the choice
made.

Thanks,
Alfia

"John W. Vinson" wrote:

On Fri, 11 May 2007 04:29:01 -0700, ajhome
wrote:

Thank you both for your input! As part of the same form, I have an option
group (check boxes.) How do I insert whatever value my user selects into my
table?


An Option Group control has a single numeric value indicating which choice the
user made. What do you want inserted in your table? That number? A text string
based on the choice? or what?

John W. Vinson [MVP]

  #10  
Old May 17th, 2007, 06:50 AM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default RunTime Error 3134

On Mon, 14 May 2007 04:42:01 -0700, ajhome
wrote:

Good Morning,

I want to be able to insert the number or a text string based on the choice
made.


Well... WHICH? Where do you want to insert it?

If you bind the option Group control to a number field, it will store the
selected number.

John W. Vinson [MVP]
 




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 07:12 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.