Results 1 to 5 of 5
  1. #1
    floyd is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    66

    Show that something has changed in form

    I have a button which allows users to find a file which is saved to the database. (File name and file location)

    The problem is... I need them to know that this was successful.

    Is there a way to have a red button which turns green.... or a text box which states the linkage was successful?


    I guess even a popup box.

    Here is the code that is used.

    Code:
    Private Sub FindFileInput_Click()
    
        Dim f As Object
        Dim strSelectedpath As String
        Dim strSelectedFile As String
        Dim varItem As Variant
    
        Set f = Application.FileDialog(3)
        f.AllowMultiSelect = False
        
        If f.Show = -1 Then
            For Each varItem In f.SelectedItems
                 strSelectedpath = varItem & "#" & varItem
                 strSelectedFile = Split(strSelectedpath, "\")(UBound(Split(strSelectedpath, "\")))
                 Next varItem
                 Me![txtSelectedFile] = strSelectedpath
                 Me![txtFileName] = strSelectedFile
                 
        End If
        Set f = Nothing
    
    End Sub

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,641
    Any of those options should be possible. But why bother? Won't they see field get populated on the form?

    A popup message box would be:

    MsgBox "File found"

    But that requires user to click a button to close box. A user aggravation in my view in this case. I use popups only when I absolutely have to. Beware overuse of message box
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    DerFarm is offline Novice
    Windows Vista Access 2010 64bit
    Join Date
    May 2011
    Posts
    8
    Presumably, you are selecting one entry from a list of possible entries.

    Could you change the color of the selected entry? Alternatively, you could perhaps change the typeface of the selected entry to Italic Bold prior to leaving the loop.

    Hope this helps.

  4. #4
    floyd is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    66
    I did THIS and I think it is working. (I get a pop up box).

    Code:
    Private Sub FindFileInput_Click()
    
        Dim f As Object
        Dim strSelectedpath As String
        Dim strSelectedFile As String
        Dim varItem As Variant
    
        Set f = Application.FileDialog(3)
        f.AllowMultiSelect = False
        
        If f.Show = -1 Then
            For Each varItem In f.SelectedItems
                 strSelectedpath = varItem & "#" & varItem
                 strSelectedFile = Split(strSelectedpath, "\")(UBound(Split(strSelectedpath, "\")))
                 Next varItem
                 Me![txtSelectedFile] = strSelectedpath
                 Me![txtFileName] = strSelectedFile
                 
    Dim Msg, Style, Title, Help, Ctxt, Response, MyString
    
    Msg = "File association successful"
    Style = vbOKOnly + vbInformation + vbDefaultButton1
    Title = "Association"
    Help = "DEMO.HLP"
    Ctxt = 1000
    
    Response = MsgBox(Msg, Style, Title, Help, Ctxt)
    
    If Response = vbYes Then    ' User chose Yes.
        MyString = "Done"    ' Perform some action.
    End If
                 
        End If
        Set f = Nothing
    
    End Sub

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,641
    MsgBox has two forms, a simple message box to user and the only response is Okay or a function that provides user with other response options. My example used the first, your code uses the latter. The difference is use of parentheses. Since the only response you allow is Okay, the function form is overkill and your If statement is useless because vbYes will never be returned by the MsgBox function.

    This code runs? I don't see a Next line to go with the For Each. That should error.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 12-22-2012, 05:33 PM
  2. Replies: 1
    Last Post: 08-15-2011, 03:20 PM
  3. Replies: 2
    Last Post: 07-19-2011, 04:28 PM
  4. Show past records for same user
    By l3111 in forum Database Design
    Replies: 3
    Last Post: 03-03-2011, 10:57 AM
  5. User focus control in AfterUpdate event
    By nosliwmada@gmailcom in forum Programming
    Replies: 3
    Last Post: 12-20-2010, 12:51 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