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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open Popup Form w/Matching ID to Main Form

Status
Not open for further replies.

CJSSC

Programmer
Nov 3, 2002
26
0
0
US
I want to open a popup form with the same unique ID (not an autonumber function). I've tried Forms!MainForm!UniqueID=Me!UniqueID in the On_Click to open the popup (Command Button on Main Form), the On_Load for the popup form, etc. with zero results.

TIA,
Cj
 
On button click event:
[tt]
dim strCriteria as string

strcriteria = "[UniqueID] = " & me!UniqueID
DoCmd.OpenForm "myPopupForm", , , strcriteria, , acDialog
[/tt]

Cheers,
Dan
 
Dan,

Here's the code I copied into the On_Click event for the command button to open the popup form:

Private Sub btnC1ProcessGasBoxSubform_Click()
Dim strCriteria As String

strCriteria = "[SystemID] = " & Me!SystemID
DoCmd.OpenForm "frmC1ProcessGasBox", , , strCriteria, , acDialog
End Sub

Still no joy! See a problem?

Cj
 
hmm, can't see a problem

add debug.print "strCriteria: " & strCritera after the "strCritera=..." line and see what it gives you.

oh, if you're at a new record then you're need to save changes in order to see then in the popup form e.g. "If me.NewRecord then me.recalc"

Dan
 
Still no joy! Here's the current code for the command button on the Main Form to bring up the popup form:

Private Sub btnC1ProcessGasBoxSubform_Click()
Dim strCriteria As String

strCriteria = "[SystemID] = " & Me!SystemID
Debug.Print "strCriteria: " & strCritera
DoCmd.OpenForm "frmC1ProcessGasBox", , , strCriteria, , acDialog
If Me.NewRecord Then Me.Recalc
End Sub

Correct place to insert the code?

Cj
 
Intermediate Window was showing zero response from the debug statement until I noticed the misspell of strCritera. Once fixed, the intermediate window is showing the correct SystemID from the MainForm but the SystemID field is still blank on frmC1ProcessGasBox. Checked Relationship as one-to-one between MainForm and popup and all spelling/names are correct.

Stumped again!

Cj
 
Mabe try to send args to the popup and then use that value as the filter for the popup form?

Here is what I have used in the past.

Code:
'main form command button on click event
Private Sub cmdOpenForm_Click()
    DoCmd.OpenForm "Master Data: mtl sg", acNormal, , , , acDialog, [material #]
End Sub

'popup form on load event
Private Sub Form_Load()
    Dim szFilter As Long
    If IsNull(Me.OpenArgs) Then
        MsgBox "opened by another form"
        DoCmd.Close , Me.Name
        Exit Sub
    End If
    
    szFilter = Me.OpenArgs
    Me.Filter = "[material #] = " & szFilter
    Me.FilterOn = True
    
End Sub
 
Well, that didn't work either. I know that the best way to have handled this would be a subform ( utilizing the LinkMaster/Child) but the required data entry fields on the MainForm prohibited it (too many) and the popups are almost as large. All underlying tables are related by the SystemID, so why can't I get these forms to sync?

Cj
 
Just a thought - if the field containing the unique ID appears on the form, rather than using a button could you not just double click on the (text?)box containing the ID to bring up the pop-up window?

I have a listbox displaying a whole range of data (in this case addresses) but the addressID is hidden; by double-clicking on an address a pop-up windows appears with the selected address, showing further details of the address for editing.

Just a simple

Private Sub List0_DblClick(Cancel As Integer)

DoCmd.OpenForm "subfrmAddressEdit", , , "AddressID = " & Me!List0

End Sub

seems to work for me!

Regards

JR
 
I have a similar situation where I don't want to use the pop-up as a subform, so here is what works for me.

Dim stDocName As String
Dim stLinkCriteria As String
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
stDocName = "Direct Billing Form"
stLinkCriteria = "[OrderNumber]=" & Me![OrderNumber]DoCmd.OpenForm stDocName, , , stLinkCriteria, , acDialog
 
you should do the recalc 'before' you open the popup form. It is quite strange that none of the suggestions have worked. Perhaps Microsoft is playing a prank on you :)

I would add navagation buttons to the popup form and see if it is filtering at all.

Cheers,
Dan
 
Not filtering at all and I am not seeing the expected <OK> or <Cancel> associated with acDialog (basically it hangs up everything).
So I tried to create a parameter query to do the table relating for data entry. All three underlying tables have been populated under the same primary key field ([SystemID]).

Here's the SQL for the query:
SELECT tblC1ConfigSystemAudit.*, tblC1ProcessGasBox.*, tblC1ConfigSystemAuditMissingParts.*
FROM tblC1ProcessGasBox INNER JOIN (tblC1ConfigSystemAuditMissingParts INNER JOIN tblC1ConfigSystemAudit ON tblC1ConfigSystemAuditMissingParts.SystemID = tblC1ConfigSystemAudit.SystemID) ON tblC1ProcessGasBox.SystemID = tblC1ConfigSystemAudit.SystemID
WHERE (((tblC1ConfigSystemAudit.SystemID)=[Enter the System ID]));

The System Audit and the Missing Parts both fire the Parameter query dialog box for the System ID, but the Process Gas Box does absolutely nothing, just blank fields.

Any ideas?

Cj[sadeyes]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top