Dbl Click property on subform (1 Viewer)

TrueBlue

New member
Local time
Today, 07:37
Joined
May 10, 2001
Messages
1
I've created a subform within a form based on a query . The subform displays Course information which is held in a Course table created by entering data in a Course form. I want to allow a user to double click the CourseName field in the subform and display the appropriate Course form which created the entry in the Course table in the first place. Also, if the subform contains no records I want to advise a user that, if they have double clicked, their action was inappropriate. I'm not able to write VBA code but can attach any offered to the Dbl Click property of the control. I'm a little more competent with macros so if anybody can advise me regarding the use of appropriate macros (OpenForm, ApplyFilter?) I could probably apply them.
 

KevinM

Registered User.
Local time
Today, 07:37
Joined
Jun 15, 2000
Messages
719
Forget macros and stick with vba, believe it or not it is easier and MUCH more flexible.

Although possiblem it is not very intuitive to have a user click on a text box to perform an action. Instead use a command button that opens up the Course form. Use the button wizard and then add a few lines

Note you MUST have the CourseID primary field on the subform.

EXAMPLE

On Error GoTo Err_Command3_Click
If isNull([CourseIDField]) Then
msgbox "No Course !"
Exit sub
Else
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "[CourseFormName]"
stLinkCriteria = "[CourseIDField] = " & [Forms]![MainFormName]![SubFormName]![CourseIDField]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command3_Click:
Exit Sub

Err_Command3_Click:
MsgBox Err.Description
Resume Exit_Command3_Click
End Sub

HTH
 

Users who are viewing this thread

Top Bottom