open form with link criteria as Read Only

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
 
M

Marshall Barton

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
 
F

fredg

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top