Senin, 23 April 2012

[MS_AccessPros] Re: Forms Population Question

 

It isn't clear why you need so many repeating values. However I would probably make the Badge control into a combobox with a Row Source of:

SELECT Badge, ID, PIN, Min([Name]) FROM tblCurrentPersonnel GROUP BY Badge, ID, PIN ORDER BY 1;
Set the number of columms to 4 and bound column to 1.

Add code to the after update of the combobox like:
Me.PIN = Me.cboBadge.Column(2)
Me.ID = Me.cboBadge.Column(1)
Me.txtName = Me.cboBadge.Column(3) 'IMO, change the name of name

Duane Hookom
MS Access MVP

--- In MS_Access_Professionals@yahoogroups.com, "Terry Olsen" <terryomsn@...> wrote:
>
> The record source of the form is tblCurrentPersonnel. All controls are bound controls. Badge, ID, PIN, Name are text boxes. Currently, I enter the same data into each of them, varying only Name to a slight degree.
> What I'd like to have the form do is:
> 1) I enter a value into badge
> 2) I move to another control on the form and
> 3) PIN, ID, and Name values are populated from Badge
> 4) I'd also need to have Name be editable as I still need to add the concatenation.
> Thanks
> Terryomsn
>
> --- In MS_Access_Professionals@yahoogroups.com, John Viescas <JohnV@> wrote:
> >
> > Terry-
> >
> > OK, what's the Record Source of the form, and please explain how you're using
> > Badge, ID, Name, and Pin and how you expect some values to autopopulate.
> >
> > John Viescas, author
> > Microsoft Office Access 2010 Inside Out
> > Microsoft Office Access 2007 Inside Out
> > Building Microsoft Access Applications
> > Microsoft Office Access 2003 Inside Out
> > SQL Queries for Mere Mortals
> > http://www.viescas.com/
> > (Villefranche-sur-mer, France)
> >
> > ------------------------------------
> >
> > From: MS_Access_Professionals@yahoogroups.com
> > [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Terry Olsen
> > Sent: Sunday, April 22, 2012 7:21 PM
> > To: MS_Access_Professionals@yahoogroups.com
> > Subject: [MS_AccessPros] Re: Forms Population Question
> >
> >  
> > Thanks, Duane. I am not storing duplicate values in the table.
> > Terryomsn
> >
> > --- In MS_Access_Professionals@yahoogroups.com, "Duane" <duanehookom@> wrote:
> > >
> > > Terryomsn,
> > >
> > > I think John was asking for more information regarding your tables. Are you
> > really storing multiple duplicate values in the same table? Is the form bound to
> > some type of a transaction table? Is there a separate employee table?
> > >
> > > How about provide more context to what you are trying to do so someone can
> > give the best help?
> > >
> > > Duane Hookom
> > > MS Access MVP
> > >
> > > --- In MS_Access_Professionals@yahoogroups.com, "Terry Olsen" <terryomsn@>
> > wrote:
> > > >
> > > > Thanks for your response.
> > > > I currently have a bound control for each of four employee fields Badge, ID,
> > Name, and Pin. While using the form, I've found that Badge needs to entered, and
> > 2 of the 3 other values are always the same and the third (Name) varies only by
> > the concatenation of a 2 character code. That works fine if I continue to enter
> > the same value 3 times.
> > > > While trying alternatives, I added 3 text boxes intending to display the
> > value entered in Badge in ID, Name, and PIN after the Badge control had been
> > populated and the user moved to another control on the form.
> > > >
> > > > Do I need to have these 3 additional text boxes or is it possible to
> > populate the original bound controls in the same manner?
> > > >
> > > > I've been studying the Access 2010 Inside Out book. While I have found
> > information on what the control and form events are, I haven't found a
> > discussion yet that pertains to populating forms in this manner. I am also
> > looking for how and when, or if I can, reference the values in the control and
> > record buffers.
> > > > Thanks
> > > > Terryomsn
> > > >
> > > > --- In MS_Access_Professionals@yahoogroups.com, John Viescas <JohnV@> wrote:
> > > > >
> > > > > Terry-
> > > > >
> > > > > How is the table containing those three fields related to the table you're
> > > > > editing? Access might fetch that info for you automatically if you include
> > that
> > > > > table in your form's Record Source, and it's linked on Badge.
> > > > >
> > > > > John Viescas, author
> > > > > Microsoft Office Access 2010 Inside Out
> > > > > Microsoft Office Access 2007 Inside Out
> > > > > Building Microsoft Access Applications
> > > > > Microsoft Office Access 2003 Inside Out
> > > > > SQL Queries for Mere Mortals
> > > > > http://www.viescas.com/
> > > > > (Villefranche-sur-mer, France)
> > > > >
> > > > > -----------------------------------
> > > > >
> > > > > From: MS_Access_Professionals@yahoogroups.com
> > > > > [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Terry Olsen
> > > > > Sent: Saturday, April 21, 2012 6:45 AM
> > > > > To: MS_Access_Professionals@yahoogroups.com
> > > > > Subject: [MS_AccessPros] Forms Population Question
> > > > >
> > > > >  
> > > > > For a new entry, I have a data entry form that I want to reduce keystrokes
> > on.
> > > > > In one bound control, badge, after initial data entry, I want to populate
> > three
> > > > > other text boxes, txtEmployeeId, txtEmployeePin, and txtEmployeeID. After
> > all
> > > > > entries on the form are complete, I want to populate fields in the DB
> > table
> > > > > columns for each of them.
> > > > > Which event do I use?
> > > > > What persists the data to the relevant DB record?
> > > > > Thanks
> > > > > Terryomsn
> > > > >
> > > >
> > >
> >
>

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar