Results 1 to 11 of 11
  1. #1
    Firemann25 is offline Novice
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    8

    Creating a pre incident program in access

    What I am attempting to create is a project in access where there is a display page where the user types in a number, this number is related to word and pdf files. These files have to be able to opened, and then closed or changed to a different file. Does this sound possible??? I do have the data in an excel book.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,515
    Yes, transfer the data to an access table.
    Click form wizard to build a continuous record form
    at the top of the form , put a box to enter the #, say txtFind
    in the code behind the txtFind_Afterupdate , filter the records to find the document

    Code:
    me.filter = "[doc#] = " & txtFind
    me.filteron = true
    at the top of the form , put a button to OPEN the document. (this assumes 1 field is the PATH to the document on the network)
    if so, the ONCLICK() code would be:

    OpenNativeApp txtPath


    Paste this code into a module, and it will open ANY file in its native application.
    a PDF file will open it in acrobat
    a .DOC file will open the doc in Word, etc.

    Code:
    'Attribute VB_Name = "modNativeApp"
    'Option Compare Database
    Option Explicit
    
    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpszOp As String, ByVal lpszFile As String, ByVal lpszParams As String, ByVal lpszDir As String, ByVal FsShowCmd As Long) As Long
    
    Private Declare Function GetDesktopWindow Lib "user32" () As Long
    Const SW_SHOWNORMAL = 1
    Const SE_ERR_FNF = 2&
    Const SE_ERR_PNF = 3&
    Const SE_ERR_ACCESSDENIED = 5&
    Const SE_ERR_OOM = 8&
    Const SE_ERR_DLLNOTFOUND = 32&
    Const SE_ERR_SHARE = 26&
    Const SE_ERR_ASSOCINCOMPLETE = 27&
    Const SE_ERR_DDETIMEOUT = 28&
    Const SE_ERR_DDEFAIL = 29&
    Const SE_ERR_DDEBUSY = 30&
    Const SE_ERR_NOASSOC = 31&
    Const ERROR_BAD_FORMAT = 11&
    
    
    Public Sub OpenNativeApp(ByVal psDocName As String)
    Dim r As Long, msg As String
    
    r = StartDoc(psDocName)
    If r <= 32 Then
        'There was an error
        Select Case r
            Case SE_ERR_FNF
                msg = "File not found"
            Case SE_ERR_PNF
                msg = "Path not found"
            Case SE_ERR_ACCESSDENIED
                msg = "Access denied"
            Case SE_ERR_OOM
                msg = "Out of memory"
            Case SE_ERR_DLLNOTFOUND
                msg = "DLL not found"
            Case SE_ERR_SHARE
                msg = "A sharing violation occurred"
            Case SE_ERR_ASSOCINCOMPLETE
                msg = "Incomplete or invalid file association"
            Case SE_ERR_DDETIMEOUT
                msg = "DDE Time out"
            Case SE_ERR_DDEFAIL
                msg = "DDE transaction failed"
            Case SE_ERR_DDEBUSY
                msg = "DDE busy"
            Case SE_ERR_NOASSOC
                msg = "No association for file extension"
            Case ERROR_BAD_FORMAT
                msg = "Invalid EXE file or error in EXE image"
            Case Else
                msg = "Unknown error"
        End Select
    '    MsgBox msg
    End If
    End Sub

  3. #3
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Personally I prefer filesystemobject commands and the followhyperlink method to open the file. Are you relying on the user to use the 'save as' function when a file needs to be renamed? or do you want to force a rename if the file is opened at all? That may be the tricky part.

  4. #4
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,387
    r = StartDoc(psDocName)
    What is StartDoc?

  5. #5
    Firemann25 is offline Novice
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    8
    The user doesn't have to 'saveas' or be renamed. They just have to be able to see the documents( word or pdf) associated with the number. Thank you for your assistance.

  6. #6
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Back to your first post. Have you used pencil and paper (or whiteboard, or....) to design your table structure? Field names and types?
    What do you have so far?

    It all starts with the design....

    Can you give 4 or 5 lines to describe what you are trying to accomplish?
    Something along the lines of "I need my dB to......"

  7. #7
    Firemann25 is offline Novice
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    8
    I have got the design created, basically want to have a box that a user enters. Once they have the number,which corresponds to a building, the corresponding word sheet will appear. The user can then toggle on at least 1 to 8 pdf's will be made available upon the need of the user.

    As far as my field names I have BldgNo, BldgName, CoverSht,Flr1,Flr2,Flr3,Flr4.

    I have that part created, and have some data entered.

  8. #8
    Firemann25 is offline Novice
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    8
    I need my db to allow the user to type in a number, and it will display information, and the flr1-4 are subject to the number of floors. The user should have the ability to open or close the coversheet and flr1-4 as necessary.

  9. #9
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I would set up the tables differently:

    Code:
    tblBuildings
    ---------------
    BldgID_PK (PK)  (Autonumber)
    BldgNo    (Text)
    BldgName (Text)
    
    
    tbl Documents
    --------------------
    Doc_ID_PK (PK)  (Autonumber)
    BldgID_FK  (Long) ( Foreign key to tblBuildings)
    BldgFloor     (Long)
    Document (Text)    (ex. would be for hyperlinks to CoverSht and PDFs)
    One building can have many floors ; one floor for one building.

    In your structure, what happens if there are more than 4 floors?

  10. #10
    Firemann25 is offline Novice
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    8
    actually the highest building is 10 floors.

  11. #11
    Firemann25 is offline Novice
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    8
    I created the table as you suggested.

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

Similar Threads

  1. ACCESS Program
    By johnseito in forum Access
    Replies: 33
    Last Post: 08-09-2014, 08:24 AM
  2. Access Program from Win xp to win 7
    By loijoc08 in forum Import/Export Data
    Replies: 5
    Last Post: 05-19-2014, 02:00 PM
  3. Help With Creating Invoice Program
    By akshay_401 in forum Access
    Replies: 1
    Last Post: 09-04-2012, 05:59 AM
  4. Program a 30-day trial into my Access Program?
    By genghiscomm in forum Programming
    Replies: 1
    Last Post: 05-26-2011, 02:14 PM
  5. Is Access the right program for me?
    By Cole in forum Access
    Replies: 1
    Last Post: 08-07-2010, 08:47 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