I run a query which returns the results in a sub table within a form. I need to have the ability to select one of the results from within the sub table and disply them in a new form; is this possible?
Taking you literally that you ahve a query datasheet as your subform, you need to do the open from the main form.
Add a button, using the wizard, to your main form(F1) which opens the second form(F2) and choose the option to find a matching record. Choose the correct matching field from F2 and any field from F1 (this will be changed later).
Complete the wizard.
Modify the code to provide the correct matching field on F2. The code should look something like this:
Private Sub Command29_Click()
On Error GoTo Err_Command29_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmProducts" ' form to be opened
' productid is on F2; productno is the matching field on the subform
My F1 contains the subform which has Query.GENQRY within it. I have created a form GENRESULTS which I want to populate from the sub form Query. When I add the button I get the following error "You have chosen forms that can't be linked. You must have at least one field that can be linked." The subform query and the GENRESULTS form both use the same query.
This message suggest that you have no fields in your main form. Is that true? If so, why do have a mainform/subform and not just the subform as your main form?
That is correct there are no fileds within the main form. The main form consists of various functions with a central sub form displaying the results of a query. Once the results have been displayed the user wants to highlight a particular row and the then edit the information in a tabbed form rather than enter the data directly into the query results.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.