Help with transactions and passing parameters

  • Thread starter Thread starter Paolo
  • Start date Start date
P

Paolo

Hi all,

Is it possible to reference a textbox on a form for a parameter when
running action queries via vba inside a transaction behind the form? I
have a series of 5 action queries requiring 4 parameters. If I refer
to the parameter as me.textboxinfo no value seems to be passed in the
sql statement. However, if I first assign a variable such as textbx =
me.textboxinfo and then insert textbx info into the sql statement
everything seems to work.

Does this make any sense?

Thanks in advance.

Paolo
 
SQL will not understand the Me. shortcut. You will have to use fully
qualified syntax:

Forms!MyFormName.textboxinfo
 
Hi Klatuu,

Thanks for the tip, but do you know why Forms!MyFormName.textboxinfo
cannot be used to define a parameter for an action query within a
transaction. For instance

strSql = "SELECT tblElements.[ElementID],
tblElements.[ElementName], " & _
"tblElements.
, tblElements.
,
tblElements.[WorkPack] " & _
"INTO tblIsolateElementAdd " & _
"FROM tblElements " & _
"WHERE tblElements.[ElementID] = '" &
Forms!MyFormName.textboxinfo & "'"
db.Execute strSql, dbFailOnError

does not work when I run it within a transaction.

Thanks in advance,

Paolo​
 
That, I don't know.

strSql = "SELECT tblElements.[ElementID],
tblElements.[ElementName], " & _
"tblElements.
, tblElements.
,
tblElements.[WorkPack] " & _
"INTO tblIsolateElementAdd " & _
"FROM tblElements " & _
"WHERE tblElements.[ElementID] = '" &
Forms!MyFormName.textboxinfo & "'"


Paolo said:
Hi Klatuu,

Thanks for the tip, but do you know why Forms!MyFormName.textboxinfo
cannot be used to define a parameter for an action query within a
transaction. For instance

strSql = "SELECT tblElements.[ElementID],
tblElements.[ElementName], " & _
"tblElements.
, tblElements.
,
tblElements.[WorkPack] " & _
"INTO tblIsolateElementAdd " & _
"FROM tblElements " & _
"WHERE tblElements.[ElementID] = '" &
Forms!MyFormName.textboxinfo & "'"
db.Execute strSql, dbFailOnError

does not work when I run it within a transaction.

Thanks in advance,

Paolo
SQL will not understand the Me. shortcut. You will have to use fully
qualified syntax:

Forms!MyFormName.textboxinfo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top