User Profile

Collapse

Profile Sidebar

Collapse
martinaPar
martinaPar
Last Activity: Jan 9 '12, 10:17 AM
Joined: Nov 11 '11
Location: Czech Republic
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • martinaPar
    replied to VBA using SQL
    @S7 Yesterday a tried something similar
    Code:
     right(suser_sname(),len(suser_sname())-charindex('\',suser_sname()))
    and it works okn as well. So again, thanks a lot for the idea. I have never used default value for a field in a table in SQL server so I have one more thing I have learnt :) I need to work with SQL and VBA, Access forms etc., but wihout any training so I learn by working...
    @NeoPa Ok, I am sorry that my question was...
    See more | Go to post

    Leave a comment:


  • martinaPar
    replied to VBA using SQL
    The idea of using 'suser_sname()' is perfect. I tried it and it works, but it looks like 'domain\user_id ' (with environ it shows only user_id) which is not a big problem. This field will be visible in the form for users, but I can rewrite it in Access so that they see only the user_id.
    Thanks a lot.
    Concerning your other points..
    1) What is CSQ? :) You mean the alias 'MaxDate'? I used table alias in another form and it works...
    See more | Go to post

    Leave a comment:


  • martinaPar
    replied to VBA using SQL
    Hi,
    it works in SQL management studio. In the subquery MaxDate it finds the last record for each mf_id (which was inserted through the form by the user, so this is "after update event" of the form) a then it adds user name to "user_name" field in the same table. Maybe it is not the most effective way to do this. But I am quit a beginner, especially in VBA.
    Martina
    See more | Go to post

    Leave a comment:


  • martinaPar
    replied to VBA using SQL
    Hi NeoPa, I am not sure what you are asking for. I have an application used by a few users. They run our process through it. They can add a comment to some cases and this comment is inserted to a table (dbo_mf_comment ) in SQL server. I need to find this record (the last one - that is why I am looking for the last date of a specific case - mf_id) and add user name. What else you need to know?
    Martina
    See more | Go to post

    Leave a comment:


  • martinaPar
    replied to VBA using SQL
    Thanks a lot. But it does not work still.. I tried to use your suggestion but the same error appeared. Maybe I will postpone this for Monday when my brain will be relaxed after the weekend:) Because I am out of ideas now...
    See more | Go to post

    Leave a comment:


  • martinaPar
    replied to VBA using SQL
    I don't know if I understand your reply correctly. The SQL is run after the "SQL". I use this in other forms and it works. Here I get the same error even if i don't use the Sub SQL but straight DoCmd.RunSQL (" ... ;"). I get runtime error 3075 - syntax error (missing operator).
    See more | Go to post

    Leave a comment:


  • martinaPar
    started a topic VBA using SQL

    VBA using SQL

    Hello all,

    I am trying to write a code in Access VBA usin SQL syntax. It should work thuis way : when a user changes a specific field in a form, his user name should be added into the table and row, where there was the change. I use event "after update". The codes is here:
    Code:
     
    Private Sub comment_AfterUpdate()
    
    SQL "UPDATE dbo_mf_comment SET [user_id] = '" & Environ("username")
    ...
    See more | Go to post
No activity results to display
Show More
Working...