A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

open form with no data



 
 
Thread Tools Display Modes
  #1  
Old May 30th, 2010, 06:50 PM posted to microsoft.public.access
Pierkes
external usenet poster
 
Posts: 15
Default open form with no data

Hi,

I have a form on which i present al lot of data from a database.
On the form is a comobox which i use to select the right record en present
the data of this record on the form.

When i open de form, de combobox is empty (which is good !) but the rest of
the form is already filled with the data of a record in the database (which
is not good). When i choose a record for the combobox, the form is filled
with the data of that particular record (which is good).

So the only problem i have is on opening the form. Is it possible to open
the form without it being filled with data of a certain record (so is see a
blank form) ?

Help will be much appreciated!
Pierre


  #2  
Old May 30th, 2010, 07:24 PM posted to microsoft.public.access
Jörn Bosse
external usenet poster
 
Posts: 7
Default open form with no data

Am 30.05.2010 19:50, schrieb Pierkes:
Hi,

I have a form on which i present al lot of data from a database.
On the form is a comobox which i use to select the right record en present
the data of this record on the form.

When i open de form, de combobox is empty (which is good !) but the rest of
the form is already filled with the data of a record in the database (which
is not good). When i choose a record for the combobox, the form is filled
with the data of that particular record (which is good).

So the only problem i have is on opening the form. Is it possible to open
the form without it being filled with data of a certain record (so is see a
blank form) ?

Help will be much appreciated!
Pierre


Hi,

you can try something like this. Create a record without any
information. That means with no entries, except of one column. For
example a 0 in a field with integer-values. When you open the Form, you
will only see that 0 and nothing else. That is the most easy way to
solve this problem, i guess.

Greetings, Jörn
  #4  
Old May 30th, 2010, 07:56 PM posted to microsoft.public.access
Rick Brandt
external usenet poster
 
Posts: 4,354
Default open form with no data

Pierkes wrote:

Hi,

I have a form on which i present al lot of data from a database.
On the form is a comobox which i use to select the right record en present
the data of this record on the form.

When i open de form, de combobox is empty (which is good !) but the rest
of the form is already filled with the data of a record in the database
(which is not good). When i choose a record for the combobox, the form is
filled with the data of that particular record (which is good).

So the only problem i have is on opening the form. Is it possible to open
the form without it being filled with data of a certain record (so is see
a blank form) ?

Help will be much appreciated!


Just open the form with a WHERE argument that has no records returned.

DoCmd.OpenForm "FormName",,,"1 = 0"

If you are using the bookmark method to show records with your ComboBox
change that to applying a filter for the desired record.

No need to mess with DataEntry mode or change Recordsets.
  #5  
Old May 30th, 2010, 10:48 PM posted to microsoft.public.access
Rick Brandt
external usenet poster
 
Posts: 4,354
Default open form with no data

Pierkes wrote:

Hi Rick,

I tried to reply to the group earlier but didn't see it appearing so
here's another go...

Thanks for your code, it works !

However, i do not use the DoCmd.OpenForm "FormName",,,"1 = 0" to open the
form but instead, to get the form to open in a subform, i use ;

SubFormArea.SourceObject = "Houses"

Any idea on how to adjest this code so it opens with a blank sheet ?
Thanks in advance,


Well, that does change the parameters of the question quite a bit. You
could try...

SubFormArea.SourceObject = "Houses"
SubFormArea.Form.Filter = "1 = 0"
SubFormArea.Form.FilterOn = True

....but I'm not sure if that would first "blink" on a record before the
filter is applied.

If you are going to use a subform then you might be best to put the ComboBox
in the main form and use the MasterLink and ChildLink properties to do the
filtering. In that case as long as the main form starts out with a ComboBox
entry that has no match in the subform then you should get a blank subform
until you change it.
  #6  
Old May 31st, 2010, 02:46 PM posted to microsoft.public.access
Pierkes
external usenet poster
 
Posts: 15
Default open form with no data

Hi Rick,

Thanks for your code, it works !

However, i do not use the DoCmd.OpenForm "FormName",,,"1 = 0" to open the
form but instead, to get the form to open in a subform, i use ;

SubFormArea.SourceObject = "Houses"

Any idea on how to adjest this code so it opens with a blank sheet ?
Thanks in advance,
Pierre

"Rick Brandt" wrote in message
...
Pierkes wrote:

Hi,

I have a form on which i present al lot of data from a database.
On the form is a comobox which i use to select the right record en
present
the data of this record on the form.

When i open de form, de combobox is empty (which is good !) but the rest
of the form is already filled with the data of a record in the database
(which is not good). When i choose a record for the combobox, the form is
filled with the data of that particular record (which is good).

So the only problem i have is on opening the form. Is it possible to open
the form without it being filled with data of a certain record (so is see
a blank form) ?

Help will be much appreciated!


Just open the form with a WHERE argument that has no records returned.

DoCmd.OpenForm "FormName",,,"1 = 0"

If you are using the bookmark method to show records with your ComboBox
change that to applying a filter for the desired record.

No need to mess with DataEntry mode or change Recordsets.



  #7  
Old May 31st, 2010, 03:14 PM posted to microsoft.public.access
Pierkes
external usenet poster
 
Posts: 15
Default open form with no data

Hi Rick,

I tried to reply to the group earlier but didn't see it appearing so here's
another go...

Thanks for your code, it works !

However, i do not use the DoCmd.OpenForm "FormName",,,"1 = 0" to open the
form but instead, to get the form to open in a subform, i use ;

SubFormArea.SourceObject = "Houses"

Any idea on how to adjest this code so it opens with a blank sheet ?
Thanks in advance,
Pierre


"Rick Brandt" wrote in message
...
Pierkes wrote:

Hi,

I have a form on which i present al lot of data from a database.
On the form is a comobox which i use to select the right record en
present
the data of this record on the form.

When i open de form, de combobox is empty (which is good !) but the rest
of the form is already filled with the data of a record in the database
(which is not good). When i choose a record for the combobox, the form is
filled with the data of that particular record (which is good).

So the only problem i have is on opening the form. Is it possible to open
the form without it being filled with data of a certain record (so is see
a blank form) ?

Help will be much appreciated!


Just open the form with a WHERE argument that has no records returned.

DoCmd.OpenForm "FormName",,,"1 = 0"

If you are using the bookmark method to show records with your ComboBox
change that to applying a filter for the desired record.

No need to mess with DataEntry mode or change Recordsets.



  #8  
Old May 31st, 2010, 04:02 PM posted to microsoft.public.access
Pierkes
external usenet poster
 
Posts: 15
Default open form with no data

Hi Rick,

Tried your code...

SubFormArea.SourceObject = "Houses"
SubFormArea.Form.Filter = "1 = 0"
SubFormArea.Form.FilterOn = True

What happened was;

1 form loaded blank (which is good)
2 the form "blinked" (which is not good...)
3 using the combobox on the form does not result in changing the data on the
form anymore (because the filter is on?)

Anuy ideas?
thanks,
Pierre


"Rick Brandt" wrote in message
...
Pierkes wrote:

Hi Rick,

I tried to reply to the group earlier but didn't see it appearing so
here's another go...

Thanks for your code, it works !

However, i do not use the DoCmd.OpenForm "FormName",,,"1 = 0" to open the
form but instead, to get the form to open in a subform, i use ;

SubFormArea.SourceObject = "Houses"

Any idea on how to adjest this code so it opens with a blank sheet ?
Thanks in advance,


Well, that does change the parameters of the question quite a bit. You
could try...

SubFormArea.SourceObject = "Houses"
SubFormArea.Form.Filter = "1 = 0"
SubFormArea.Form.FilterOn = True

...but I'm not sure if that would first "blink" on a record before the
filter is applied.

If you are going to use a subform then you might be best to put the
ComboBox
in the main form and use the MasterLink and ChildLink properties to do the
filtering. In that case as long as the main form starts out with a
ComboBox
entry that has no match in the subform then you should get a blank subform
until you change it.



  #9  
Old May 31st, 2010, 07:35 PM posted to microsoft.public.access
David W. Fenton
external usenet poster
 
Posts: 3,373
Default open form with no data

"Pierkes" wrote in
:

So the only problem i have is on opening the form. Is it possible
to open the form without it being filled with data of a certain
record (so is see a blank form) ?


Use a recordsource like this, where "MyTable" is the smallest table
in your application, and the fieldnames are the fields controls on
the form are bound to:

SELECT TOP 1 Null As Field1, Null As Field2, Null As Field3
FROM MyTable

This gives you a single blank record that is uneditable. You would
then change the recordsource in the code that does the search.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:40 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.