Problems with code???

J

James

Hi,

Ok I have no ID field in my UNION query... Would I need
one of these for the code to work?

Also how would I go about clearing all the forms so that
when they open they dont display the data?

Many Thanks

James
-----Original Message-----
what are wanting to accomplish? if you need to search several data sources
using a union query and open the recordset (or form with recordset as
rowsource) of the found records source, then:
uniquely identify the recordsource table somehow. once the record is found
then open the appropriate form using a bookmark to go to the specified
record.
Hello I have 2 problems both related to the same form.

Right heres what I have got:

I have 3 forms and on main form.... The main form has a
combo box which has three values. Each value corrisponds
to one of the forms and pulls up the relevant form. Then
when you select another option from the combo box i9t
again pulls up the relevant form and hides the previous
form. This is all for a search form. I have created a
UNION query with help from some MVP's (Thanks again guys)
and I have based the main form on that UNION query. This
is because it joins 4 tables together. Ok now when I open
the main form I get a combo box at the top and two
buttons... One of which exits the form and the other which
searched the current form...

Now when I open one of the forms from the combo box all
the records seem to be displayed. This I dont want as its
a pointless excersise having to trall through all the
records which are displayed when I have the search
facility which is much more efficiant and less time
consuming. So my first question would be how do I stop all
the records from being shown?

The next one is within the coding for the seach facility...

I have the following:

FilterMe = "[id] > 0"

If chkcisco1 Then FilterMe = FilterMe & " AND [Forname]
= " & cbocisco1

DoCmd.ApplyFilter , FilterMe

End Sub

On the On Click command of the search records button.
Obviously I have more lines of this same code but with teh
fields names changed? Is this code right? if not how can I
correct it so that it searched the relevant records?

I have been given the following advice:

Use the Forms Where property i.e

DoCmd.Openform "SomeForm",,,,"ID=NULL"

I have a question about the above:

I am running the forms as sub forms how can I encorporate
thisinto this scenario? What happens is a user selects a
value from my combo box which then opens the relevant form
as a sub form. How can I do what is being asked with then
as a sub form?

Can anyone help with the above and the problem with why my
code dosent work when I try to use it to search for
records?

Many Thanks and your help will be appreciated

James
 
J

Jeff Boyce

James

Have you attempted the UNION query to see if it works without ID fields?

Your forms have a "DataEntry" property -- if set to "Yes", they open without
displaying data.

Good luck

Jeff Boyce
<Access MVP>
 
J

James

Yes I have it runs either way its just I cannot get it to
search with teh current code I have...

So if I set teh data entry property to No then when I open
the forms they wont display the data and only will display
the records that meet the search criteria?

Many Thanks

James
 
J

Jeff Boyce

James

What does "searching" have to do with your initial post? What is it that
won't search? Remember, we're not there, we can't see what you're working
on.

Perhaps you could step back from "how" you are trying to do something and
spend a bit more time describing "what" you want to be able to do. Include
a description of your tables/fields and the kind of data you are working
with.

More info, please...

Jeff Boyce
<Access MVP>
 

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