Need help with quote marks in a query

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

Guest

Hello,

I need help with the following UPDATE query. I'm having problems with the
placement of single and double quotes. "Me.txtNewRoleName" is a textbox on
the form. I want to use the value of this object in the query. Query is:

"UPDATE tblPreRoleApplMapping Set NewRoleName = '" & Me.txtNewRoleName & "'"

Hard to see but this is what I have: ...Name = ' " & Me.txtNewRoleName & "
' "

I added an extra space before and after the single quote so its easier to see.

Thanks,
Rich
 
Hello,

I need help with the following UPDATE query. I'm having problems with the
placement of single and double quotes. "Me.txtNewRoleName" is a textbox on
the form. I want to use the value of this object in the query. Query is:

"UPDATE tblPreRoleApplMapping Set NewRoleName = '" & Me.txtNewRoleName & "'"

Hard to see but this is what I have: ...Name = ' " & Me.txtNewRoleName & "
' "

I added an extra space before and after the single quote so its easier to see.

Thanks,
Rich

If you are running this from code on your form, using either the
Execute or RunSQL method, then:

DoCmd.RunSQL "UPDATE tblPreRoleApplMapping Set
tblPreRoleApplMapping.NewRoleName = '" & Me.txtNewRoleName & "'"
should work.

However, if this is in an existing query, then use:

UPDATE tblPreRoleApplMapping Set tblPreRoleApplMapping.NewRoleName =
Forms!FormName!txtNewRoleName
 
Back
Top