Problem with locking a form

Cicak

Registered User.
Local time
Today, 00:32
Joined
May 20, 2008
Messages
31
Hi,

Is there conflict between making a form read-only and having a hyperlink field on that form?

This is what I am hoping to do:
When a selection is made from the combo box of a form, another form opens for confirmation purposes. (E.g. If Item 1 is selected, a form about item details opens, showing specifically the record of Item 1 so that users can check.) The information in the second form cannot be changed.

I'm using this code to open the form as "read only":
DoCmd.OpenForm FormName, acNormal, , "[PartNumber]='" & Me!PartNumber & "'", acFormReadOnly

And so it opens as "read-only". But there is a button (called "Select file") on the form, that opens a dialog box that allows users to select a file for the hyperlink. Though indeed the form is at first read-only, this button allows users to change/add the hyperlink and after this happens the form is no longer read-only.

This button was created by following the instructions found on this site: http://www.utteraccess.com/forums/printthread.php?Cat=&Board=89&main=1611468&type=thread

The code used for the button is like this:
Code:
  Dim strFilter As String
    Dim strInputFileName As String
 
        strFilter = ahtAddFilterItem(strFilter, "PDF Files (*.PDF)", "*.PDF")
        strFilter = ahtAddFilterItem(strFilter, "Word Files (*.DOC)", "*.DOC*")
        strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")
        strInputFileName = ahtCommonFileOpenSave( _
                    Filter:=strFilter, OpenFile:=True, _
                    DialogTitle:="Please select the file to attach", _
                    Flags:=ahtOFN_HIDEREADONLY)
 
        If Len(strInputFileName) > 0 Then
            Me.AttachSpecSheet = "#" & strInputFileName & "#"
        End If

A module (modFileDialog) is involved and it's from: http://www.mvps.org/access/api/api0001.htm

Why does changing/adding the attachment seem to make the form lose its "read only-ness"? Is there a way (apart from Enable -> No) to prevent users from clicking the "Select file" button? :confused:

Thanks in advance! :)
Regards.
 
Hi,

In case anyone ever encounters a similar situation...

I haven't really resolved the problem, but what I think what I might do next is to try to make the "Select file" button invisible. Maybe by doing something similar to having, on the button to open the confirmation form (on click) OpenArgs "ConfirmationForm". And for the confirmation form itself, on load, If Me.OpenArgs = "ConfirmationForm" Then NameOfButton.Visible = False

I'm not sure how well this will work, though. I don't know much about code.. Any pointers are sincerely appreciated.

Thanks for reading. :D
 

Users who are viewing this thread

Back
Top Bottom