Results 1 to 3 of 3

Thread: VBA SQL Query no working

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2002
    Location
    Glasgow, Scotland
    Posts
    202

    VBA SQL Query no working

    HI there,

    i have set up user level security and am implementing some tracking for the users. this is part of a delete record section of code

    Code:
        'append user name carrying out deletion
        dbs.Execute "UPDATE tblDeletions" _
            & " SET tblDeletions.MyUserName = " & lpUserName & "" _
            & " WHERE tbldeletions.ID = " & strRefNum & ";"
    i am getting a to few parameters message for this section of code.

    it seems to relate to the lpUserName which has been assigned the currently logged on users name.

    ive tried messing it around a little but still end up back at the same place with teh to few parameters.

    Im sure its something simple, as if i use a fixed string it works:
    Code:
        'append user name carrying out deletion
        dbs.Execute "UPDATE tblDeletions" _
            & " SET tblDeletions.MyUserName = 'LoggedOnUser'" _
            & " WHERE tbldeletions.ID = " & strRefNum & ";"
    TIA for any suggestions

    Brian
    if you fail to plan, you plan to fail

  2. #2
    Lively Member
    Join Date
    Jun 2003
    Posts
    114
    Where are the quotes around the username?

    & " SET tblDeletions.MyUserName = '" & lpUserName & "'" _

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2002
    Location
    Glasgow, Scotland
    Posts
    202
    Originally posted by M Owen
    Where are the quotes around the username?

    & " SET tblDeletions.MyUserName = '" & lpUserName & "'" _
    Thank you..

    sorted, i knew i was missing something..
    if you fail to plan, you plan to fail

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width