Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22
  1. #16
    megatronixs is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    91
    Hi all,



    I got a little bit further :-)
    addding these lines to it :
    Code:
        Dim User As String
        User = Environ("username")
        Forms![frm_Edit_Reviews]![Checker_name].Value = User
    fills in the username when the forms open.

    What I still can't get to work is from the button in the previous post:" Private Sub btn_next_check_Click()"

    Now to get things going, I have to run firts the button that will run query and so on, once I have the results in the sub form, and then I need to click on the second button that will open the form and get the user name there.

    Is it possible like in excel to call a second macro to run?

    Greetings.

  2. #17
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    What exactly happens when you run the code you posted in post #12? Error messages?
    Have you tried to step through that code?

    Also, I was not trying to be harsh with you. It was just that in the course of a 5 -6 line post, your message went from Solved to How to Solve????

    I understand video blocks and that can be frustrating.
    We only know what you tell us about your issue and attempts, so please be thorough.

    Good luck.

  3. #18
    nick404's Avatar
    nick404 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2015
    Location
    Wisconsin
    Posts
    352
    Take out your error handler and see what it gives you as an error

  4. #19
    megatronixs is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    91
    Hi Orange,,

    There are no errors, it just does the first part (show the query results), no opening the form and fill in the user name :-(


    this is the code for the button to do it all in one:
    Code:
    Private Sub btn_next_check_Click()
        Dim stDocName As String
        Dim sSQL4 As String
        Dim varUserLock
        Dim stLinkCriteria As String
        Dim User As String
        User = Environ("username")
    On Error GoTo errr
        sSQL4 = "SELECT TOP 1 ID FROM qry_next_case"
        
        Me.frm_Reviews_subform.Form.RecordSource = sSQL4
        
        Me.frm_Reviews_subform.Form.RecordSource = Me.frm_Reviews_subform.Form.RecordSource
        
        Exit Sub
    errr:
        MsgBox Err.Description
        
        stDocName = "frm_Edit_Reviews"
        DoCmd.OpenForm stDocName, , , , , acWindowNormal
        Forms![frm_Edit_Reviews]![Checker_name].Value = User
    End Sub
    Myabe there is a silly thing in it that prevents it :-(

    Greetings

  5. #20
    nick404's Avatar
    nick404 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2015
    Location
    Wisconsin
    Posts
    352
    It is a silly thing haha.
    Because you errr does not exit sub after. This part:
    Code:
    stDocName = "frm_Edit_Reviews"
    DoCmd.OpenForm stDocName, , , , , acWindowNormal
    Forms![frm_Edit_Reviews]![Check_name].Value = User
    

    Is in your error handler. place an exit sub after MsgBox Err.Description
    This is why it only performs the query and nothing else


    Also you are exiting the sub before these lines can even take place.

  6. #21
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    @megatronixs

    Put a break point on this line
    Code:
    sSQL4 = "SELECT TOP 1 ID FROM qry_next_case"
    then step through the code using F8 to see what is actually being executed. (see the link I gave in post #17)

    You should spend some time reviewing the debugging techniques, they can be very valuable to isolate "coding issues".

  7. #22
    megatronixs is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    91
    Hi all,

    It was really the silly mistake that kept it from running :-)
    I just did not see it, just only after nick404 pointed it out.

    You are right orange, need to check out more the debugging :-)

    thank you all a LOT for helping out.

    Greetings.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 10-09-2014, 07:09 PM
  2. Replies: 1
    Last Post: 03-02-2014, 01:31 PM
  3. Replies: 2
    Last Post: 08-07-2013, 07:44 AM
  4. Help on report to open form to open query...
    By saseymour in forum Programming
    Replies: 13
    Last Post: 07-16-2013, 08:11 AM
  5. Replies: 1
    Last Post: 05-03-2012, 02:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums