Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with floating form 1

Status
Not open for further replies.

Jayz

ISP
Feb 17, 2002
59
In continous form view, I'd like to be able to click on a record and have a popup floating form that displays the infomation that was entered into a particular field in that record i clicked. And when Scrolling across the continuos form, always have the popup form visable.

Reason being is I have one field "Notes" which has a 200 char limit and I don't really want to expand the text box to view the whole string (very impractical as this varies in sivz). Also clicking in the field and scrolling across to view what has been entered is a pain.

Any help would be much appreciated
 
Create a pop-up form with the same table as its record source that the continuous form has.

Populate the Pop-up form with the notes field and size it accordingly.

Assuming the two forms are called MainForm and PopupForm
in the OnCurrent event of MainForm type the following code:


Private Sub Form_Current()
If IsLoaded("PopupForm") Then
DoCmd.SelectObject acForm, "PopupForm", 0
DoCmd.GoToRecord , , acGoTo, Forms!MainForm.CurrentRecord
DoCmd.SelectObject acForm, "MainForm", 0

End If

End Sub


For this to work the IsLoaded function needs to exist in a Public Module in your database. It simply prevents the OnCurrent event from attempting to implement a method on a non existing object. You can copy the IsLoaded function from the Northwind database.

Rod

 
Hi Rod,

I couldn't get this to work, I did everything you wrote.
I created my popup form "Popupform" and my mainform was called "OM_Search2"
The code I put in the Oncurrent Event was:

Private Sub Form_Current()
If IsLoaded("PopupForm") Then
DoCmd.SelectObject acForm, "PopupForm", 0
DoCmd.GoToRecord , , acGoTo, Forms!OM_Search2.CurrentRecord
DoCmd.SelectObject acForm, "OM_Search2", 0

End If

End Sub
***********************
I then addded the module from the Northwind Database as:

Function IsLoaded(ByVal strFormName As String) As Boolean
' Returns True if the specified form is open in Form view or Datasheet view.

Const conObjStateClosed = 0
Const conDesignView = 0

If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> conObjStateClosed Then
If Forms(strFormName).CurrentView <> conDesignView Then
IsLoaded = True
End If
End If

End Function
**********************

What am I doing wrong?. Does pulling the records from a query affect this?.

Thanks,
Jay


 
Everything looks OK but the IsLoaded function must be declared as a Public Function. That is to say that it must appear in a public module written as follows:


Public Function IsLoaded(ByVal strFormName As String) As Boolean
' Returns True if the specified form is open in Form view or Datasheet view.

Const conObjStateClosed = 0
Const conDesignView = 0

If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> conObjStateClosed Then
If Forms(strFormName).CurrentView <> conDesignView Then
IsLoaded = True
End If
End If

End Function


Fingers crossed,
Rod


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top