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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Open Form Artificially Blank



 
 
Thread Tools Display Modes
  #1  
Old January 17th, 2010, 07:26 PM posted to microsoft.public.access.forms
jschping
external usenet poster
 
Posts: 33
Default Open Form Artificially Blank

Hi,

I have a form bound to a set number of records. I do not want the user to be
able to add any new records.

I have a combo box with some VB code to allow the user to select one of the
records to be able to edit it.

When they first open the form, it shows the first record's info. I would
prefer that all the fields were blank until they use the combo-box to select
a record.

How can I do this? I don't want to create a dummy blank record and make that
open first, because then I have an empty record floating around to mess up my
reports. Also, I don't want the user to be able to edit that "dummy" record
and give it info.

What do you suggest?

Thanks!!!

John Schping
  #2  
Old January 17th, 2010, 09:07 PM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Open Form Artificially Blank

On Sun, 17 Jan 2010 11:26:01 -0800, jschping
wrote:

Hi,

I have a form bound to a set number of records. I do not want the user to be
able to add any new records.

I have a combo box with some VB code to allow the user to select one of the
records to be able to edit it.

When they first open the form, it shows the first record's info. I would
prefer that all the fields were blank until they use the combo-box to select
a record.

How can I do this? I don't want to create a dummy blank record and make that
open first, because then I have an empty record floating around to mess up my
reports. Also, I don't want the user to be able to edit that "dummy" record
and give it info.

What do you suggest?

Thanks!!!

John Schping


About the only way would be to base the form on a Query which you can be sure
returns no records. Say you have an Autonumber primary key (that the combo box
uses to select the record); you could base the form on a query selecting

IDField = 0

as a criterion (after assuring yourself that there is no 0 record!!)

The code in the combo box would then change the form's recordsource to the
single record containing that value.

This has the additional advantage that the form is never populated by more
than one record, making it more efficient - especially if you have a split
application or a SQL/Server network backend.
--

John W. Vinson [MVP]
  #3  
Old January 18th, 2010, 02:56 AM posted to microsoft.public.access.forms
AccessVandal via AccessMonster.com
external usenet poster
 
Posts: 461
Default Open Form Artificially Blank

Well, for me I would use the form's properties.

1. Allow Edits
2. Allow Deletions
3. Allow Additions
4. Data Entry

You can use the OnOpen event or in the form's properties to set 1 or 2 or 3
to "No" and set Data Entry to Yes. Setting DataEntry to "Yes" will show blank
record on the form and AllowEdits to "No" will prevent data entry. Setting
certain combination may hide your controls but you can use the search combo
box in the form's header to change the form's properties "Allow
Edits/Additons" and "Data Entry". (do not place the search combo in the
detail section of the form)

jschping wrote:
Hi,

I have a form bound to a set number of records. I do not want the user to be
able to add any new records.

I have a combo box with some VB code to allow the user to select one of the
records to be able to edit it.

When they first open the form, it shows the first record's info. I would
prefer that all the fields were blank until they use the combo-box to select
a record.

How can I do this? I don't want to create a dummy blank record and make that
open first, because then I have an empty record floating around to mess up my
reports. Also, I don't want the user to be able to edit that "dummy" record
and give it info.

What do you suggest?

Thanks!!!

John Schping


--
Please Rate the posting if helps you.

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201001/1

  #4  
Old January 18th, 2010, 04:03 AM posted to microsoft.public.access.forms
jschping
external usenet poster
 
Posts: 33
Default Open Form Artificially Blank

Hi,

Thanks for replying.

Your idea sounds great, especially since it will be a split database over a
network.

What code do I use to change the SQL behind a forms recordset?

Thanks,

John Schping

"John W. Vinson" wrote:

On Sun, 17 Jan 2010 11:26:01 -0800, jschping
wrote:

Hi,

I have a form bound to a set number of records. I do not want the user to be
able to add any new records.

I have a combo box with some VB code to allow the user to select one of the
records to be able to edit it.

When they first open the form, it shows the first record's info. I would
prefer that all the fields were blank until they use the combo-box to select
a record.

How can I do this? I don't want to create a dummy blank record and make that
open first, because then I have an empty record floating around to mess up my
reports. Also, I don't want the user to be able to edit that "dummy" record
and give it info.

What do you suggest?

Thanks!!!

John Schping


About the only way would be to base the form on a Query which you can be sure
returns no records. Say you have an Autonumber primary key (that the combo box
uses to select the record); you could base the form on a query selecting

IDField = 0

as a criterion (after assuring yourself that there is no 0 record!!)

The code in the combo box would then change the form's recordsource to the
single record containing that value.

This has the additional advantage that the form is never populated by more
than one record, making it more efficient - especially if you have a split
application or a SQL/Server network backend.
--

John W. Vinson [MVP]
.

  #5  
Old January 18th, 2010, 05:15 AM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Open Form Artificially Blank

On Sun, 17 Jan 2010 20:03:01 -0800, jschping
wrote:

What code do I use to change the SQL behind a forms recordset?


Me.RecordSource = strSQL

where strSQL is a valid SQL statement returning the fields that you want on
the form.
--

John W. Vinson [MVP]
  #6  
Old January 18th, 2010, 03:04 PM posted to microsoft.public.access.forms
jschping
external usenet poster
 
Posts: 33
Default Open Form Artificially Blank

Thanks!!

"John W. Vinson" wrote:

On Sun, 17 Jan 2010 20:03:01 -0800, jschping
wrote:

What code do I use to change the SQL behind a forms recordset?


Me.RecordSource = strSQL

where strSQL is a valid SQL statement returning the fields that you want on
the form.
--

John W. Vinson [MVP]
.

  #7  
Old January 18th, 2010, 06:09 PM posted to microsoft.public.access.forms
Chegu Tom
external usenet poster
 
Posts: 140
Default Open Form Artificially Blank

You may want to use a main form and subform
The main form is unbound and has the combo box to select a record. Default
value is null
The subform (your current form minus the combo box) is bound to your table
and linked to the main form by the combo box.

When you start the subform will be empty. When you select a record in the
combo box of the main form the subform is populated



"jschping" wrote in message
...
Hi,

I have a form bound to a set number of records. I do not want the user to
be
able to add any new records.

I have a combo box with some VB code to allow the user to select one of
the
records to be able to edit it.

When they first open the form, it shows the first record's info. I would
prefer that all the fields were blank until they use the combo-box to
select
a record.

How can I do this? I don't want to create a dummy blank record and make
that
open first, because then I have an empty record floating around to mess up
my
reports. Also, I don't want the user to be able to edit that "dummy"
record
and give it info.

What do you suggest?

Thanks!!!

John Schping



 




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 12:52 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.