RE: VBA Code Help



I did in the last post

--
Good Luck
BS"D


"alfiajamel" wrote:

You have been so much help thus far, however, I am just not getting it right!
Would you be willing to type the code out for me?

"Ofer Cohen" wrote:

Try

Would someone please tell me what I am doing wrong?!!??!? I have tried the
quotes and I am still getting a compile error. Both ID fields are text. My
coding is below (at least my attempt at coding):
CurrentDb.Execute "DELETE FROM tblMovement " & _
" WHERE EmpId = '" & lstNewSupervisor.Column(0) & _
"' AND SupervisorID = '" & txtSupervisorID & "'"

**** In the last line you have double quote to much in the beggining, and
missing an & in the end to include the last single quote, and I assume by
your code that both fields SupervisorID and EmpId are text fields, if they
not you'll get a type mismatch, in that case remove the single quote

--
Good Luck
BS"D


"alfiajamel" wrote:

Greetings...

Would someone please tell me what I am doing wrong?!!??!? I have tried the
quotes and I am still getting a compile error. Both ID fields are text. My
coding is below (at least my attempt at coding):
CurrentDb.Execute "DELETE FROM tblMovement " & _
"WHERE EmpId = '" & lstNewSupervisor.Column(0) & _
"'" AND SupervisorID = '" & txtSupervisorID "'"

"Ofer Cohen" wrote:

Make sure that the txtSupervisorID and lstNewSupervisor.Column(0) return value.

CurrentDb.Execute "DELETE FROM tblMovement " & _
"WHERE EmpId = '" & lstNewSupervisor.Column(0) & _
"' AND SupervisorID = " & txtSupervisorID

If txtSupervisorID field will be blank you'll get syntax error

--
Good Luck
BS"D


"alfiajamel" wrote:

Greetings...

I am getting a complie syntex error with the code listed below! Can someone
please help me with it? The ID Fields are text fields.


CurrentDb.Execute "DELETE FROM tblMovement " & _
"WHERE EmpId = '" & lstNewSupervisor.Column(0) & _
"' AND SupervisorID = " & txtSupervisorID

Thanks!

.



Relevant Pages

  • RE: VBA Code Help
    ... quotes and I am still getting a compile error. ... coding is below: ... missing an & in the end to include the last single quote, ... "alfiajamel" wrote: ...
    (microsoft.public.access.formscoding)
  • RE: VBA Code Help
    ... quotes and I am still getting a compile error. ... coding is below: ... "alfiajamel" wrote: ...
    (microsoft.public.access.formscoding)
  • Re: How to code this...
    ... I knew what I was doing when it came to coding. ... want them to....just keep experimenting. ... I haven't had any luck implementing it yet. ... Then using the insert html code fragment ...
    (microsoft.public.publisher.webdesign)
  • Re: To Joe Fallon - tried, but no work.
    ... Good luck. ... Then it highlights the Sub ... > an error saying "Compile Error - Variable not defined". ...
    (microsoft.public.access.externaldata)
  • To Joe Fallon - tried, but no work.
    ... When I clicked on the control button, ... Manipulate and Excel Workbook) No luck here either. ... an error saying "Compile Error - Variable not defined". ... Then it highlights the next to the last line of code ...
    (microsoft.public.access.externaldata)