Use Form to Open Another Form

D

Don Trieschman

From a form, I want to pass parameters to a query to open
another form (form by query?). Using a combo box to select a certain
field works ok. But I am having trouble passing those fields which are
check boxes. Get "data mismatch". The fields in the underlying table
are 'yes/no'.
 
D

Don Trieschman

I might add after some research, it appears that I am having problems
with syntax on the WhereCondition argument in the OpenForm...
 
D

Don Trieschman

Here goes:
stDocName = "frmTest"
stWhereCondition = _
"MyStuff.Owner = '" & "Forms![frmSelectView]![cboOwner] & '" And _
"Items.Active = '" & "Forms![frmSelectView]![chkActive] & '"

Problem is concatenating the parts.

DoCmd.OpenForm stDocName, , , stWhereConditionOn Sat, 23 Aug 2003
09:04:55 +1000, "Van T. Dinh"
 
V

Van T. Dinh

You cannot put the line continuation characters ( Space + _ ) in a literal
String and if [Items].[Active] is a Boolean Field, don't wrap it in single
quotes. You got the single quotes and double quotes wrong as well.

Assuming Owner is of Text Type and Active is a Boolean, try:

stWhereCondition = _
"Owner = '" & Forms![frmSelectView]![cboOwner] & _
"' AND Active = " & Forms![frmSelectView]![chkActive]

I am also concerned about [MyStuff] and [Items]. They look like Table Names
you used in the RecordSource Query / SQL String and they might not come
through to the Form; hence I left them out.

If you cannot get it to work, post the SQL String (of the Query) you used as
the RecordSource for the Form you are trying to open.
 

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