468,132 Members | 1,515 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,132 developers. It's quick & easy.

Queries, Forms and Initilization?

I'm pretty new to using Access and VB and have the following problem:

Basically, I have a main form with a ProductID edit box and a subform
which has its source object set to a query. The query is set to return
all the values in the table with the ProductID found in the edit box.
This used to work fine when I had the query criteria set to:


However, now I need to include this form as an object in another form

Dim myForm As MainForm
Set myForm = New MainForm

However, in doing this the query needs to be modified (I think). Now I
set the criteria to:


When I use myForm.SubForm.SourceObject = "MyQuery"

A dialog pops up asking for [ProductID] - like it doesn't know what
the value is. The mystery is that when a function I have created is
called which continually resets the edit box to a new value and
performs SubForm.Requery the query knows exactly where to get the
ProductID value from.

e.g. myForm.SubForm.SourceObject = "MyQuery" 'Dialog pops up :(
myForm.ProductID = 100
myForm.SubForm.Requery ' Returns the needed data using the
value 100
myForm.ProductID = 23
myForm.SubForm.Requery ' Returns the needed data using the
value 23
Nov 13 '05 #1
0 994

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Diego Devesa | last post: by
6 posts views Thread by puzzlecracker | last post: by
5 posts views Thread by vsnadagouda | last post: by
1 post views Thread by gcdp | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.