Hello.
I have a form in my db (call it MAIN) containing various fields from table tbl_main. What I want to do, is to create a button on my switchboard in order for the user to open the form in read only mode, based on a value for “net no” that he/she will give as an input. This value corresponds to NET field in table (tbl_main).
I thought that by using the docmd.openform with open arguments will do the job, however I didn’t make it to work. The code:
Private Sub option2_view_Click()
On Error GoTo Err_RecViewUser_Click
Dim asknet As String
asknet = InputBox("Please Enter a valid Net No", "NET No REQUIRED")
If asknet = "" Then
MsgBox "Enter Net No to continue", vbInformation, " NET No VALUE NEEDED"
Else
DoCmd.OpenForm " MAIN", acNormal, , , acFormReadOnly, acWindowNormal, {enter your suggestion for Openargs here}
Forms! MAIN.NavigationButtons = False
Exit_RecViewUser_Click:
Exit Sub
Err_RecViewUser_Click:
MsgBox Err.Description
End If
End Sub
I have also gave a try with the where option of the openform, but without any luck :banghead:
Thank you in advance for your assistance. Any suggestions are more than welcome.
Alex
I have a form in my db (call it MAIN) containing various fields from table tbl_main. What I want to do, is to create a button on my switchboard in order for the user to open the form in read only mode, based on a value for “net no” that he/she will give as an input. This value corresponds to NET field in table (tbl_main).
I thought that by using the docmd.openform with open arguments will do the job, however I didn’t make it to work. The code:
Private Sub option2_view_Click()
On Error GoTo Err_RecViewUser_Click
Dim asknet As String
asknet = InputBox("Please Enter a valid Net No", "NET No REQUIRED")
If asknet = "" Then
MsgBox "Enter Net No to continue", vbInformation, " NET No VALUE NEEDED"
Else
DoCmd.OpenForm " MAIN", acNormal, , , acFormReadOnly, acWindowNormal, {enter your suggestion for Openargs here}
Forms! MAIN.NavigationButtons = False
Exit_RecViewUser_Click:
Exit Sub
Err_RecViewUser_Click:
MsgBox Err.Description
End If
End Sub
I have also gave a try with the where option of the openform, but without any luck :banghead:
Thank you in advance for your assistance. Any suggestions are more than welcome.
Alex