By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,486 Members | 2,061 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,486 IT Pros & Developers. It's quick & easy.

need help, not sure with what....

P: n/a
i pulled an example off the web and modified it somewhat and whats killimg
me is that sometimes it works and sometimes it doesnt.
the following is the only line that allows this thing to work over and over,
ive tried untold number of combinations , some have been left in as comments
all will work right at the start but fail for no apparent reason later
'strsql = "insert into [license-table](orderinfofkey, lstring, link) values
(1,'test', 'test2')"

text122 and text124 are unbound text boxes for me to enter stuff with,
the form is an order tracking form
this button is supposed to allow me to enter multiple licesne string and a
secondary string and associate it with the current orderinfokey in a
separate table.

it works fine when i first open the database but after using this feature
about 6-7 times, it just dies on me and highlights
condatabase.execute strsql in yellow

the error message says
run-time error '-2147217904 (80040e10)':
No value given for one or more requested parameters.

the MsgBox strsql is supposed to show what access sees and its always had
values listed in there so I am not sure why this is dying on me. The only
way to fix it is to completely shut down the application and start it up
again.
Private Sub Command127_Click()
Dim strsql As String
Dim string1 As String
Dim string2 As String
Dim keynum As Integer

Dim condatabase As Connection

keynum = Me.OrderInfokey.Value
string1 = Me.Text122.Value
string2 = Me.Text124.Value
Set condatabase = CurrentProject.Connection
'strsql = "insert into [license-table](orderinfofkey, lstring, link) values
(1,'test', 'test2')"
'strsql = "insert into [license-table] (orderinfofkey, lstring, link) values
(" & OrderInfokey & ", " & string1 & ", " & string1 & ")"
'strsql = "insert into [license-table] (orderinfofkey, lstring, link) values
(" & OrderInfokey & ", " & Text122 & ", 'test2'
strsql = "insert into [license-table] (orderinfofkey, lstring, link) values
(" & OrderInfokey & ", " & Text122 & ", " & Text124 & ")"

MsgBox strsql
condatabase.Execute strsql

condatabase.Close

End Sub


Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Steve" <1@2.com> wrote in message
news:Lu******************@newsread1.news.atl.earth link.net...
i pulled an example off the web and modified it somewhat and whats killimg
me is that sometimes it works and sometimes it doesnt.
the following is the only line that allows this thing to work over and over, ive tried untold number of combinations , some have been left in as comments all will work right at the start but fail for no apparent reason later
'strsql = "insert into [license-table](orderinfofkey, lstring, link) values (1,'test', 'test2')"

text122 and text124 are unbound text boxes for me to enter stuff with,
the form is an order tracking form
this button is supposed to allow me to enter multiple licesne string and a secondary string and associate it with the current orderinfokey in a
separate table.

it works fine when i first open the database but after using this feature
about 6-7 times, it just dies on me and highlights
condatabase.execute strsql in yellow

the error message says
run-time error '-2147217904 (80040e10)':
No value given for one or more requested parameters.

the MsgBox strsql is supposed to show what access sees and its always had
values listed in there so I am not sure why this is dying on me. The only
way to fix it is to completely shut down the application and start it up
again.
Private Sub Command127_Click()
Dim strsql As String
Dim string1 As String
Dim string2 As String
Dim keynum As Integer

Dim condatabase As Connection

keynum = Me.OrderInfokey.Value
string1 = Me.Text122.Value
string2 = Me.Text124.Value
Set condatabase = CurrentProject.Connection
'strsql = "insert into [license-table](orderinfofkey, lstring, link) values (1,'test', 'test2')"
'strsql = "insert into [license-table] (orderinfofkey, lstring, link) values (" & OrderInfokey & ", " & string1 & ", " & string1 & ")"
'strsql = "insert into [license-table] (orderinfofkey, lstring, link) values (" & OrderInfokey & ", " & Text122 & ", 'test2'
strsql = "insert into [license-table] (orderinfofkey, lstring, link) values (" & OrderInfokey & ", " & Text122 & ", " & Text124 & ")"

MsgBox strsql
condatabase.Execute strsql

condatabase.Close

End Sub


The text data needs quotes around it. Like this:

strsql = "insert into [license-table] (orderinfofkey, lstring, link) values
(" & OrderInfokey & ", """ & Text122 & """, """ & Text124 & """)"

or like this:

strsql = "insert into [license-table] (orderinfofkey, lstring, link) values
(" & OrderInfokey & ", '" & Text122 & "', '" & Text124 & "')"

Either should work.

HTH,
Randy Harris
Nov 13 '05 #2

P: n/a
Right off-hand, it appears that you need to concatenate in some quotes
around the two string parameters.
strsql = "insert into [license-table] (orderinfofkey, lstring, link)
values
(" & OrderInfokey & ", " & Text122 & ", " & Text124 & ")"
In your example that you say works every time, you are showing Test and
Test2 with quotes around them as if they are strings. If string values are
expected in these two locations, OrderInfokey contains 1, Text122 contains
Test, and Text124 contains Test2, then the above would look like this after
it was concatenated.

insert into [license-table] (orderinfofkey, lstring, link) values (1, Test,
Test2)

but you need it to look like

insert into [license-table] (orderinfofkey, lstring, link) values (1,
'Test', 'Test2')

Try amending the line to:

strsql = "insert into [license-table] (orderinfofkey, lstring, link) values
(" & OrderInfokey & ", '" & Text122 & "', '" & Text124 & "')"

Note the single quotes placed next to the double quotes around the string
values. If the string values themselves may have apostrophes in them, such
as O'Hare, then a slight modification will need to be made.

--
Wayne Morgan
MS Access MVP
"Steve" <1@2.com> wrote in message
news:Lu******************@newsread1.news.atl.earth link.net...i pulled an example off the web and modified it somewhat and whats killimg
me is that sometimes it works and sometimes it doesnt.
the following is the only line that allows this thing to work over and
over,
ive tried untold number of combinations , some have been left in as
comments
all will work right at the start but fail for no apparent reason later
'strsql = "insert into [license-table](orderinfofkey, lstring, link)
values
(1,'test', 'test2')"

text122 and text124 are unbound text boxes for me to enter stuff with,
the form is an order tracking form
this button is supposed to allow me to enter multiple licesne string and
a
secondary string and associate it with the current orderinfokey in a
separate table.

it works fine when i first open the database but after using this feature
about 6-7 times, it just dies on me and highlights
condatabase.execute strsql in yellow

the error message says
run-time error '-2147217904 (80040e10)':
No value given for one or more requested parameters.

the MsgBox strsql is supposed to show what access sees and its always had
values listed in there so I am not sure why this is dying on me. The only
way to fix it is to completely shut down the application and start it up
again.
Private Sub Command127_Click()
Dim strsql As String
Dim string1 As String
Dim string2 As String
Dim keynum As Integer

Dim condatabase As Connection

keynum = Me.OrderInfokey.Value
string1 = Me.Text122.Value
string2 = Me.Text124.Value
Set condatabase = CurrentProject.Connection
'strsql = "insert into [license-table](orderinfofkey, lstring, link)
values
(1,'test', 'test2')"
'strsql = "insert into [license-table] (orderinfofkey, lstring, link)
values
(" & OrderInfokey & ", " & string1 & ", " & string1 & ")"
'strsql = "insert into [license-table] (orderinfofkey, lstring, link)
values
(" & OrderInfokey & ", " & Text122 & ", 'test2'
strsql = "insert into [license-table] (orderinfofkey, lstring, link)
values
(" & OrderInfokey & ", " & Text122 & ", " & Text124 & ")"

MsgBox strsql
condatabase.Execute strsql

condatabase.Close

End Sub

Nov 13 '05 #3

P: n/a
awesome, you guys rock, thanks alot
"Steve" <1@2.com> wrote in message
news:Lu******************@newsread1.news.atl.earth link.net...
i pulled an example off the web and modified it somewhat and whats killimg
me is that sometimes it works and sometimes it doesnt.
the following is the only line that allows this thing to work over and over, ive tried untold number of combinations , some have been left in as comments all will work right at the start but fail for no apparent reason later
'strsql = "insert into [license-table](orderinfofkey, lstring, link) values (1,'test', 'test2')"

text122 and text124 are unbound text boxes for me to enter stuff with,
the form is an order tracking form
this button is supposed to allow me to enter multiple licesne string and a secondary string and associate it with the current orderinfokey in a
separate table.

it works fine when i first open the database but after using this feature
about 6-7 times, it just dies on me and highlights
condatabase.execute strsql in yellow

the error message says
run-time error '-2147217904 (80040e10)':
No value given for one or more requested parameters.

the MsgBox strsql is supposed to show what access sees and its always had
values listed in there so I am not sure why this is dying on me. The only
way to fix it is to completely shut down the application and start it up
again.
Private Sub Command127_Click()
Dim strsql As String
Dim string1 As String
Dim string2 As String
Dim keynum As Integer

Dim condatabase As Connection

keynum = Me.OrderInfokey.Value
string1 = Me.Text122.Value
string2 = Me.Text124.Value
Set condatabase = CurrentProject.Connection
'strsql = "insert into [license-table](orderinfofkey, lstring, link) values (1,'test', 'test2')"
'strsql = "insert into [license-table] (orderinfofkey, lstring, link) values (" & OrderInfokey & ", " & string1 & ", " & string1 & ")"
'strsql = "insert into [license-table] (orderinfofkey, lstring, link) values (" & OrderInfokey & ", " & Text122 & ", 'test2'
strsql = "insert into [license-table] (orderinfofkey, lstring, link) values (" & OrderInfokey & ", " & Text122 & ", " & Text124 & ")"

MsgBox strsql
condatabase.Execute strsql

condatabase.Close

End Sub

Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.