enter parameter value

mana

Registered User.
Local time
Today, 09:41
Joined
Nov 4, 2014
Messages
265
hello

i have the following code

Dim str As String
str = "select combination from tbl_userinformation where Username= txtuser.value AND actualdate=txtdate.value ; "
If DCount("*", "tbl_userinformation", " [05-Henrichpiramid]=true AND " & _
"Username = '" & Me![txtuser] & _
"' AND [actualdate] = " & Format(Me![txtdate], "\#mm\/dd\/yyyy\#")) > 0 Then
DoCmd.RunSQL (" update tbl_userinformation SET combination = str &'05-Henrichpiramid' where Username= txtuser.value AND actualdate=txtdate.value ;")


but when i run it it asks me for enter parameter value for str
can you help me please?
i don't know what my problem is
thank you
 
In the final line of code, you didn't use str as a variable you used it as text. When you want to use it as a variable you have to seperate it from the text:

str="blah blah blah"

example="The variable str contains this text: " & str


in example "blah blah blah" only occurs once now--at the end, not in the middle.
 
i couldn't understand you exactly
what do you mean ?
i want to use str as text and combine it with another text. do you know how i should use it
 
When you surround anything with quotes it is text:

Print "str"

Will output 3 characters (str). When you don't its a variable:

Print str

Will output whatever is in str. In the last line of your code you are using str like text not a varialbe.

"ThisIsAVariable" is not a variable, its a string.
ThisIsAString is not a string, its a variable.

If inside quotes, a string, if not a variable. Since str is inside quotes in your code, its used as a string.
 
thank you for your reply

but i found this example on the internet

LSQL = "Select * from Suppliers"
LSQL = LSQL & " where Supplier_ID = 2345"

i don'T know how i should change my code
do you know?
can you help me ?
 

Users who are viewing this thread

Back
Top Bottom