PC Review


Reply
Thread Tools Rate Thread

Clearing fields on a form (on open) when a combo box is used

 
 
=?Utf-8?B?Um9u?=
Guest
Posts: n/a
 
      4th Nov 2006
I have carfully read all of the questions regarding combo boxes and cannot
find anything that applies. I know it's simple, but I just can't seem to get
it. I have a form with an unbound combo box which is used to select a
record. That works fine. What I want is for the form to open with all of
the fields blank. Any guidance you can provide would be greatly appreciated.

Ron
 
Reply With Quote
 
 
 
 
Rick Brandt
Guest
Posts: n/a
 
      4th Nov 2006
Ron wrote:
> I have carfully read all of the questions regarding combo boxes and
> cannot find anything that applies. I know it's simple, but I just
> can't seem to get it. I have a form with an unbound combo box which
> is used to select a record. That works fine. What I want is for the
> form to open with all of the fields blank. Any guidance you can
> provide would be greatly appreciated.
>
> Ron


Assuming that this is a bound form then the only time the controls will all be
blank is when you are on the new record position. You would have to use code in
the Open event to take the form to that position.

DoCmd.RunCommand acCmdRecordsGoToNew


--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


 
Reply With Quote
 
=?Utf-8?B?Um9u?=
Guest
Posts: n/a
 
      4th Nov 2006
Rick,

Thanks for the quick answer. Since I am not a VBA guru, I will need a
little more information as to exactly what code to include and on that
action. I tried just adding it to the control to open the form, but it
bombed. Thanks in advance for your help.

Ron

"Rick Brandt" wrote:

> Ron wrote:
> > I have carfully read all of the questions regarding combo boxes and
> > cannot find anything that applies. I know it's simple, but I just
> > can't seem to get it. I have a form with an unbound combo box which
> > is used to select a record. That works fine. What I want is for the
> > form to open with all of the fields blank. Any guidance you can
> > provide would be greatly appreciated.
> >
> > Ron

>
> Assuming that this is a bound form then the only time the controls will all be
> blank is when you are on the new record position. You would have to use code in
> the Open event to take the form to that position.
>
> DoCmd.RunCommand acCmdRecordsGoToNew
>
>
> --
> Rick Brandt, Microsoft Access MVP
> Email (as appropriate) to...
> RBrandt at Hunter dot com
>
>
>

 
Reply With Quote
 
Rick Brandt
Guest
Posts: n/a
 
      4th Nov 2006
Ron wrote:
> Rick,
>
> Thanks for the quick answer. Since I am not a VBA guru, I will need a
> little more information as to exactly what code to include and on that
> action. I tried just adding it to the control to open the form, but
> it bombed. Thanks in advance for your help.


In the property sheet of the form while in design view go to the Events tab and
find the On Open event property. In the list of choices choose [Event
Procedure] then press the build button [...] to the right. In the VBA window
that will open enter...

DoCmd.RunCommand acCmdRecordsGoToNew

....between the two lines that will have been pre-built that define the
sub-routine for the Open event.


--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com



 
Reply With Quote
 
=?Utf-8?B?Um9u?=
Guest
Posts: n/a
 
      4th Nov 2006
Rick,

Adding this code to the command used to open the form accomplished the task
and resolved my issue:

DoCmd.GoToRecord , , acNewRec

Thanks for your help. Without it I would have never solved my problem.

Ron

"Ron" wrote:

> Rick,
>
> Thanks for the quick answer. Since I am not a VBA guru, I will need a
> little more information as to exactly what code to include and on that
> action. I tried just adding it to the control to open the form, but it
> bombed. Thanks in advance for your help.
>
> Ron
>
> "Rick Brandt" wrote:
>
> > Ron wrote:
> > > I have carfully read all of the questions regarding combo boxes and
> > > cannot find anything that applies. I know it's simple, but I just
> > > can't seem to get it. I have a form with an unbound combo box which
> > > is used to select a record. That works fine. What I want is for the
> > > form to open with all of the fields blank. Any guidance you can
> > > provide would be greatly appreciated.
> > >
> > > Ron

> >
> > Assuming that this is a bound form then the only time the controls will all be
> > blank is when you are on the new record position. You would have to use code in
> > the Open event to take the form to that position.
> >
> > DoCmd.RunCommand acCmdRecordsGoToNew
> >
> >
> > --
> > Rick Brandt, Microsoft Access MVP
> > Email (as appropriate) to...
> > RBrandt at Hunter dot com
> >
> >
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clearing fields from a form... =?Utf-8?B?ZGNhc2g0NQ==?= Microsoft Access 0 29th Jun 2006 06:05 PM
Combo box with 3 fields used to open new form bjaneb Microsoft Access Forms 1 31st May 2006 04:29 PM
Clearing Form Fields on 1st Doc Open only? TomorrowsMan Microsoft Word Document Management 2 5th May 2006 12:10 PM
Clearing fields on a form =?Utf-8?B?bWpqNGdvbGY=?= Microsoft Access Form Coding 1 22nd Mar 2006 03:36 PM
Open a form based on 2 fields from 2 combo boxes =?Utf-8?B?Sm9zZSBTYW50b3M=?= Microsoft Access Forms 2 6th May 2004 12:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:05 PM.