PopUp From Subform

R

rico

I have created a button that opens a related record from a subform, like the
'See Product Details' button in the Access 2002 sample database 'orders'. I
used the following code:

Private Sub Command36_Click()

Dim strDocName As String
Dim strLinkCriteria As String

On Error GoTo ErrorHandler

strDocName = "FaultReportForm"
strLinkCriteria = "Date = Forms!UnitData!UnitDataSubq!Date"
DoCmd.OpenForm strDocName, , , strLinkCriteria

Exit Sub

ErrorHandler:
MsgBox "Error#: " & Err.Number & vbCrLf & Err.Description
End Sub

The problem is my subform represents a union query which draws from a few
different tables, 'FaultReportForm' is just one of the forms. Is there a bit
of code
i could use so it can open the correct form out of a few forms.

Also the above code doesn't work on the first click, it shows a blank
record, it only shows the corrent record if the form is already open.

Any help much appreciated

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top