InsertInto Problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a program that records will be added to a table through a form. I have
the form set up but am having memory problems when it comes to the Insert
Into.
Basically, I have a table containing 5 fields. Four of the fields will be
updated with what is in a certain text box on that form.
What I have so far is:
strSQL = "Insert Into Table(SS#,StartDate,TestType,DateDue)
Values(

The values is where I stop. I don't know what will be put into the field
until the text box is filled by the user, except for the due date and that
will be calculated by a loop. So I know I need to put something to the effect
of:

Values( txtSS#, txtStart,txtTest,(dteDueDate))

But I don't know what kind of punctuation I need. I see all kinds of
apostrophe's on examples I have come across but none really apply. I would
appreciate any help on this. I have been here for a week and it is getting
old.
Thanks for any help.
 
I think it is a mistake to use "#" in a field name, however try:
strSQL = "Insert Into Table([SS#],StartDate,TestType,DateDue) " & _
"Values('" & Me.[txtSS#] & "', #" & Me.txtStart & "#, " & _
Me.txtTest & ", #" & dteDueDate & "#)"

The above assumes SS# is text and TestType is numeric.
 
Am I missing something here?

Base your form on the table. Enter your data. Move off the current
record

The data from the form is now in the table.

HTH
 
Thank you so much. This will help save my sanity. I am going to go ahead and
change the "#" so that isn't in there. I realized that it was a mistake to
use it. I appreciate the time and patience. I will give it a try today.
Thank you again.

Duane Hookom said:
I think it is a mistake to use "#" in a field name, however try:
strSQL = "Insert Into Table([SS#],StartDate,TestType,DateDue) " & _
"Values('" & Me.[txtSS#] & "', #" & Me.txtStart & "#, " & _
Me.txtTest & ", #" & dteDueDate & "#)"

The above assumes SS# is text and TestType is numeric.


--
Duane Hookom
MS Access MVP
--

amy14775 said:
I have a program that records will be added to a table through a form. I
have
the form set up but am having memory problems when it comes to the Insert
Into.
Basically, I have a table containing 5 fields. Four of the fields will be
updated with what is in a certain text box on that form.
What I have so far is:
strSQL = "Insert Into Table(SS#,StartDate,TestType,DateDue)
Values(

The values is where I stop. I don't know what will be put into the field
until the text box is filled by the user, except for the due date and that
will be calculated by a loop. So I know I need to put something to the
effect
of:

Values( txtSS#, txtStart,txtTest,(dteDueDate))

But I don't know what kind of punctuation I need. I see all kinds of
apostrophe's on examples I have come across but none really apply. I would
appreciate any help on this. I have been here for a week and it is getting
old.
Thanks for any help.
 
Back
Top