open form with link criteria as Read Only

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I have the the code below for opening a form with link criteria.
need to open the form as read only..how?


Mattias



Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "TransaktionshuvudDepo"

stLinkCriteria = "[Transaktionsnr]=" & Me![Transaktionsnr]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Form_Open:
Exit Sub

Err_Form_Open:
MsgBox Err.Description
Resume Exit_Form_Open

End Sub
 
Mattias said:
I have the the code below for opening a form with link criteria.
need to open the form as read only..how?


Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "TransaktionshuvudDepo"

stLinkCriteria = "[Transaktionsnr]=" & Me![Transaktionsnr]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Form_Open:
Exit Sub

Err_Form_Open:
MsgBox Err.Description
Resume Exit_Form_Open

End Sub


A quick look in Help indicates that you want to use:

DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormReadOnly
 
Hi

I have the the code below for opening a form with link criteria.
need to open the form as read only..how?

Mattias

Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "TransaktionshuvudDepo"

stLinkCriteria = "[Transaktionsnr]=" & Me![Transaktionsnr]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Form_Open:
Exit Sub

Err_Form_Open:
MsgBox Err.Description
Resume Exit_Form_Open

End Sub

Doesn't your VBA help work?
Even if you simply wrote the OpenForm code, Intellisense would have
given you the various options as you typed.

DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormReadOnly
 
Back
Top