Trouble with Query Results & New Records

R

ridawg

Hey,

I have a form that queries a database and returns data in the datafields
scetion. It also has a button for creating new records.

I didn't use the default New Record button but instead created a button so
that I could set a rule on it to switch to a different view (an entry view).

The problem I've run into is when I query the database and have results
returned then select my New Record button - the all the records in my query
results are displayed in my entry view instead of a 1 set of fields that are
blank (i.e. a new record).

My guess is because I created my own button instead of using the default New
Record button I need to write some code to not only switch the view but
return/create a blank record. Does that sound right?

Any help would be greatly appreciated!
 
A

Adam Harding

Hi

No code is needed on the button set the button to use rules and custom code
and then use rules to clear out all of the datafields individually.

that way the new record will be clean when you switch views to it.

Cheers Adam
 
R

ridawg

Adam,

Thanks for replying but I don't think this will solve the problem. I'm not
sure I explained this well so let me try again.

First - I have 3 views: Search, Edit, New. The form itself has an Access
database as its datasource.

On the Search view you can search against the database and I have button for
entering a new record.

This is problem I'm having. If I do a search against the database and
records are returned then click the New Record button to switch to the New
view instead of seeing the fields I need to enter for a New Record it
actually displays all the records that were returned in the search and it
doesn't display fields to enter a New Record.

My thought is I need to some how clear the search then execute the New
Record button. The reason being I open up the form and don't do a search and
just click the New Record button I don't have any problems.

Any ideas?
 
A

Adam Harding

Hi

Absolutely, they hold on to the same values as they have not been cleared.

The ACTIONS on the rule on your button unfortunately need to say

Select to set a field's value - Field1 then OK out of there do not set any
value.
Do this for every field that exists in both. CLumsy but will work.

You can use it to your advantage for drill-down etc. But not handy for this.

One other way that may help would be to submit data in the query that does
not and cannot ever exist in the database, that will return a clean form as
there is no data it can find. To make use of this use a rule on the button
for new record to set a field in the search to its maximum value ie a date
field to 01/01/3006, then use the rule to query the data connection and off
you go.

Hope this helps

Adam
 

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