If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Multiple Instances problem
My main form (called Patient Records) is a tab form with
different sub forms on each tab page. My problem is that when I open the form using the a button with the code below, none of my calculations that reference fields on these different tab pages works! It gives a #Name? error. Any new instances I open from the button on the main form have the same problem. However, when I open the form independent of this code, there is no problem, nor is there any problem with the added instances. This of course leads me to believe that my code to open the initial instance has problems. How it works is that I have a button on my Main Menu to open the search dialog box (called SearchBox). After searching, the results are displayed in a continuous subform with the button containing this code as part of each of the continuous records. Anybody have any ideas on what the problem could be? Private Sub ViewRecord_Click() Dim frm As Form Dim lngHwnd As Long Dim blnFound As Boolean If IsNumeric(Forms.searchbox.CalledFrom) Then 'Find the calling form lngHwnd = Forms.searchbox.CalledFrom For Each frm In Forms If frm.hWnd = lngHwnd Then 'Find this record in that form. With frm.RecordsetClone .FindFirst "[ID]=" & Me![ID] If Not .NoMatch Then frm.Bookmark = .Bookmark blnFound = True End If End With Exit For End If Next Else Set frm = New [Form_Patient Records] frm.Visible = True frm.Caption = "Patient Records: " & Now() 'Append it to collection clnPatientRecords.Add Item:=frm, Key:=CStr (frm.hWnd) 'Find this record in that form. With frm.RecordsetClone .FindFirst "[ID]=" & Me![ID] If Not .NoMatch Then frm.Bookmark = .Bookmark blnFound = True End If End With DoCmd.Close acForm, "SearchBox" End If If blnFound Then 'Focus on the calling form, and close this one. frm.SetFocus Set frm = Nothing DoCmd.Close acForm, "SearchBox" Else Beep End If Set frm = Nothing End Sub |
#2
|
|||
|
|||
Multiple Instances problem
No takers on this one? If anyone can help me figure this
out, I'd really appreciate it. Thanks. -----Original Message----- My main form (called Patient Records) is a tab form with different sub forms on each tab page. My problem is that when I open the form using the a button with the code below, none of my calculations that reference fields on these different tab pages works! It gives a #Name? error. Any new instances I open from the button on the main form have the same problem. However, when I open the form independent of this code, there is no problem, nor is there any problem with the added instances. This of course leads me to believe that my code to open the initial instance has problems. How it works is that I have a button on my Main Menu to open the search dialog box (called SearchBox). After searching, the results are displayed in a continuous subform with the button containing this code as part of each of the continuous records. Anybody have any ideas on what the problem could be? Private Sub ViewRecord_Click() Dim frm As Form Dim lngHwnd As Long Dim blnFound As Boolean If IsNumeric(Forms.searchbox.CalledFrom) Then 'Find the calling form lngHwnd = Forms.searchbox.CalledFrom For Each frm In Forms If frm.hWnd = lngHwnd Then 'Find this record in that form. With frm.RecordsetClone .FindFirst "[ID]=" & Me![ID] If Not .NoMatch Then frm.Bookmark = .Bookmark blnFound = True End If End With Exit For End If Next Else Set frm = New [Form_Patient Records] frm.Visible = True frm.Caption = "Patient Records: " & Now() 'Append it to collection clnPatientRecords.Add Item:=frm, Key:=CStr (frm.hWnd) 'Find this record in that form. With frm.RecordsetClone .FindFirst "[ID]=" & Me![ID] If Not .NoMatch Then frm.Bookmark = .Bookmark blnFound = True End If End With DoCmd.Close acForm, "SearchBox" End If If blnFound Then 'Focus on the calling form, and close this one. frm.SetFocus Set frm = Nothing DoCmd.Close acForm, "SearchBox" Else Beep End If Set frm = Nothing End Sub . |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Productkey problem when installing office 2003 on network | Stefan Schreurs | Setup, Installing & Configuration | 1 | June 1st, 2004 11:16 PM |
word error | mac | General Discussions | 1 | May 6th, 2004 08:14 AM |
multiple instances | Aaron | Worksheet Functions | 2 | March 3rd, 2004 07:36 PM |
Multiple Conditions and Multiple Solutions | Frank Kabel | Worksheet Functions | 0 | February 4th, 2004 09:22 PM |
Multiple Instances of Excel opening | Carolyn | Setting up and Configuration | 1 | September 19th, 2003 02:13 AM |