PC User
Registered User.
- Local time
- Today, 13:14
- Joined
- Jul 28, 2002
- Messages
- 193
I'm creating a shortcut menu to popup over my richtext box. Its a form with a listbox of menu items with associated richtext activex (rtf) editing commands. My problem is transferring the rtf editing commands as strings from the listbox popup menu over to the main form that has the richtext box that I am editing. I made a Public Function in a module that should captures the string from the menu and an event subroutine in the main form that is suppose to call the string from the Public Function. The codes are as follows:
============================
The main form is "WorkBook"
The popup form is "fdlgMenuRFT"
The listbox is "lstMenu"
============================
The Public Function in a module
============================
============================
The event subroutine in the main form.
============================
============================
The selection code in the popup form:
============================
============================
I can't get this to work. Can someone help me in transferring a string value between forms?
============================
The main form is "WorkBook"
The popup form is "fdlgMenuRFT"
The listbox is "lstMenu"
============================
The Public Function in a module
============================
Code:
Public Function GetRftMenuString() As String
Dim ctlCurrentControl As Control
Dim frmCurrentForm As Form
Dim strControlName As String
Dim frm As Access.Form
Debug.Print Application.Screen.ActiveForm.Name
Set frmCurrentForm = Screen.ActiveForm 'Return form object pointing to active form.
Set ctlCurrentControl = Screen.ActiveControl 'Return control object pointing to active control.
Set frm = frmCurrentForm
strControlName = ctlCurrentControl.Name
End Function
The event subroutine in the main form.
============================
Code:
Private Sub RichMemo_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal Y As Long)
Dim EditCommand As String
If Button = acRightButton Then
Call rftMenu
End If
EditCommand = GetRftMenuString()
End Sub
The selection code in the popup form:
============================
Code:
Private Sub lstMenu_DblClick(Cancel As Integer)
Forms("WorkBook").RichText1.Value = lstMenu.Value
'Forms("WorkBook").RichText1.Value = Me!lstMenu.Column(1)
DoCmd.Close acForm, "fdlgMenuRFT"
End Sub
I can't get this to work. Can someone help me in transferring a string value between forms?
Last edited by a moderator: