Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 2nd, 2008, 09:03 AM
Authorized User
 
Join Date: May 2007
Location: , , .
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default subform

I have come across numerous methods of opening and locating a filename to have a link within the database to other files e.g. pdf docs, word docs, spreadsheets etc.

What i am trying to do is move that code into a common module that will be called from subforms or 3rd level subfroms. Its starting to do my head in.

Examples of the situation:

Student Main Form
Unbound subform which the contents change according to an option group
Option 1 Subform containing identity documents. The subform linked to a table which has a fields say identdocfilename and identdocfilepath

Option 2
a subform containing two further subforms - details and list continuous
e.g. correspondence and summary of information linked together
date, who sent it, title, filename, path, summary

For various reasons can't give the real situation so those are generic ideas that match it.

Now to simplify the coding I am wanting a module that the button open file to enter the file name would call from whatever level of form it is in.

The code I've been using in a top level form is:

Private Sub btnadddoc_Click()
    On Error GoTo cmdAddSmall_Err

    Dim strFilter As String
    Dim lngflags As Long
    Dim varFileName As Variant

    strFilter = "All Files (*.*)" & vbNullChar & "*.*" _
        & vbNullChar & "All Files (*.*)" & vbNullChar & "*.*"

    lngflags = tscFNPathMustExist Or tscFNFileMustExist _
        Or tscFNHideReadOnly

    varFileName = tsGetFileFromUser( _
    fOpenFile:=True, _
    strFilter:=strFilter, _
    rlngflags:=lngflags, _
    strDialogTitle:="Please choose a file...")

    If IsNull(varFileName) Then
        Else
            Me![FilePath] = varFileName
    End If

cmdAddSmall_End:
    On Error GoTo 0
    Exit Sub

cmdAddSmall_Err:
    Beep
    MsgBox Err.Description, , "Error: " & Err.Number _
    & " in file"
    Resume cmdAddSmall_End
    Resume

end sub

The code works as there is a dialogue module to support it with the standard hnd code in it.

The main issue is the subforms levels that's causing the comprehension problem or mindblock.

If someone knows where there is a tutorial or sample database I can see please put a link up.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Referencing a subform scandalous Access 2 March 16th, 2007 07:05 AM
Search in subform webace Access 0 June 12th, 2006 11:52 AM
Filter Subform B Based on Field in Subform A SerranoG Access VBA 3 June 18th, 2004 12:23 AM
subform functions V Access 2 April 26th, 2004 05:45 AM
Referring to a Subform mikericc Access 1 April 9th, 2004 04:50 PM



All times are GMT -4. The time now is 10:51 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.