Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17
  1. #16
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    Fair enough. To clarify, I'm saying that a With block is usually used where you want to deal with several properties or methods of the parent object (the focus of the With statement) and not just one. All of the bold words below are properties or methods of the parent object which is in red.
    Code:
    With fDialog
        .AllowMultiSelect = False
        .Filters.Clear
        .Filters.Add "Excel Spreadsheets", "*.xls, *.xlsx, *.xlsm, *.xlsb"
        If .Show Then
         strFileName = .SelectedItems(1)
         'Do something here
        Else
         MsgBox "message here."
         Exit Sub
        End If
    End With

    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  2. #17
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,191
    Can see what you mean by the fDialog being the parent object, i do need to study more instead of playing, if i can praise myself, i do have several databases that work quite well with a good percentage of playing with code and seeing the help and advice from you guy's on here does kind of open up what is possible through a very complex Microsoft application, it can be quite eye opening....

    I think adjusting your methods is probably the main changes required.

    When I initially started coming away from wizards in the year dot to start forcing the results that wizards don't give, there are many things that helps such as simple things of keeping all Dims on one line such as

    str
    lng
    int
    bln
    var

    etc etc

    Even that makes the declarations easier to read.

    I still have a habit of copying old code that wasn't written good and make adjustments for a new procedure which is likely the wrong way.

    Change habit and start new I'm sure will be agreed on here

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

Similar Threads

  1. Replies: 6
    Last Post: 09-13-2019, 02:57 AM
  2. Finding Excel Row
    By DMT Dave in forum Access
    Replies: 6
    Last Post: 01-11-2019, 01:29 PM
  3. Replies: 1
    Last Post: 05-22-2018, 07:47 AM
  4. Finding and updating cells in an Excel worksheet
    By GraeagleBill in forum Programming
    Replies: 12
    Last Post: 01-10-2018, 06:55 PM
  5. Replies: 2
    Last Post: 02-10-2016, 09:15 AM

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