By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,041 Members | 1,734 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,041 IT Pros & Developers. It's quick & easy.

Urgent! Subform populating another form

P: n/a
I have a form with a sub-form (in continuous forms view to simulate a
datasheet view)
from which the user can double-click a product number and open a new
form which will display that number and lookup all its details (about
30 fields) which will display also.
I first tried this code on the textbox of the subform (using the on
doubleclick event):
[Forms]![ProductDetailForm]![ProductNumber] = [Forms]![MainForm]!
[SearchSubform]! _[ProductNumber] to populate the textbox only for the
detail form, which it did sucessfully, but I can't get the DetailForm
to get the other 29 fields to populate. I tried something like this
unsuccessfully on the AfterUpdate event for the successfully populated
ProductNumber textbox, but nothing else populated:

Private Sub ProductNumber_AfterUpdate()
Dim rs As DAO.Recordset
If Not IsNull(Me.ProductNumber) Then
If Me.Dirty Then
Me.Dirty = False
End If
Set rs = Me.RecordsetClone
rs.FindFirst "[ProductNumber] = " & Me.AssetNumber
If rs.NoMatch Then
MsgBox "Not found: filtered?"
Else
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
End Sub

I tried writing a query on the load event of the detail form:

Private Sub Form_Load()
DoCmd.OpenQuery "ProductDetailQuery"
End Sub

Here's the query:

SELECT Products.[ProductNumber]..................etc.
FROM Products
WHERE (((Products.[ProductNumber])=[Forms]![MainForm]![SearchSubform]!
[Product Number]));

This failed to work also.... any help would be appreciated!! Thanks!

Mar 20 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On 19 Mar 2007 20:10:49 -0700, ca***************@yahoo.com wrote:

Create a form and bind it to the Product table. Make sure you can
scroll through the products just fine.
Invoke that form from the double-click event as follows:
DoCmd.OpenForm "MyProductForm", , , "ProductID=" & Me.ProductID

This assumes your Product table has a ProductID field (primary key).

-Tom.

>I have a form with a sub-form (in continuous forms view to simulate a
datasheet view)
from which the user can double-click a product number and open a new
form which will display that number and lookup all its details (about
30 fields) which will display also.
I first tried this code on the textbox of the subform (using the on
doubleclick event):
[Forms]![ProductDetailForm]![ProductNumber] = [Forms]![MainForm]!
[SearchSubform]! _[ProductNumber] to populate the textbox only for the
detail form, which it did sucessfully, but I can't get the DetailForm
to get the other 29 fields to populate. I tried something like this
unsuccessfully on the AfterUpdate event for the successfully populated
ProductNumber textbox, but nothing else populated:

Private Sub ProductNumber_AfterUpdate()
Dim rs As DAO.Recordset
If Not IsNull(Me.ProductNumber) Then
If Me.Dirty Then
Me.Dirty = False
End If
Set rs = Me.RecordsetClone
rs.FindFirst "[ProductNumber] = " & Me.AssetNumber
If rs.NoMatch Then
MsgBox "Not found: filtered?"
Else
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
End Sub

I tried writing a query on the load event of the detail form:

Private Sub Form_Load()
DoCmd.OpenQuery "ProductDetailQuery"
End Sub

Here's the query:

SELECT Products.[ProductNumber]..................etc.
FROM Products
WHERE (((Products.[ProductNumber])=[Forms]![MainForm]![SearchSubform]!
[Product Number]));

This failed to work also.... any help would be appreciated!! Thanks!
Mar 20 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.