I have a combo box on my form (Form1) that lets users select an employee from
the pull down list. Sometimes employees will be put on the inactive list but
may have already been chosen on a record via Form1. What I want to know is if
it's possible to keep that inactive employee stored in this table but have it
removed from the combo box so they can't be selected again. I have another
form that I use to trigger this inactive state.
How can this work?
Frank H - 23 May 2007 03:38 GMT
i'm no expert, but achieved something like this by redefining the combo's
rowsource in the on current event of the form so that it excluded inactive
employees if a new record, and included it if an existing record.
> I have a combo box on my form (Form1) that lets users select an employee from
> the pull down list. Sometimes employees will be put on the inactive list but
[quoted text clipped - 4 lines]
>
> How can this work?
Secret Squirrel - 23 May 2007 03:42 GMT
Can you show me an example of this?
> i'm no expert, but achieved something like this by redefining the combo's
> rowsource in the on current event of the form so that it excluded inactive
[quoted text clipped - 8 lines]
> >
> > How can this work?
Frank H - 23 May 2007 04:01 GMT
in the on current event of form1 put something like this.
dim strSQL as String
strSQL="SELECT tblUsers.UserName FROM tblUsers"
if me.newrecord=true then
strSQL=strSQL & vbcrlf & "WHERE (((tblUsers.Inactive)=False))"
endif
strSQL=strSQL & ";"
me.combo.rowsource=strSQL
me.combo.requery
This will ensure that for previously entered records, all user names are
available to display,
but if a new record only those that are not inactive will appear.
HTH
> Can you show me an example of this?
>
[quoted text clipped - 10 lines]
> > >
> > > How can this work?
Dave - 23 May 2007 03:43 GMT
Secret Squirrel,
Change the Row Source property of the combo box to a query that only returns
the active employees. You will also want to change the Limit To List property
to Yes which will deny users from manually typing in an inactive employee.
All of your existing records will remain unchanged.
Hope that helps
Dave
> I have a combo box on my form (Form1) that lets users select an employee from
> the pull down list. Sometimes employees will be put on the inactive list but
[quoted text clipped - 4 lines]
>
> How can this work?
Secret Squirrel - 23 May 2007 03:46 GMT
But what if a record exists with a now inactive employee? Will the table
still retain that employee even though it no longer shows up in the list?
> Secret Squirrel,
> Change the Row Source property of the combo box to a query that only returns
[quoted text clipped - 13 lines]
> >
> > How can this work?
Dave - 23 May 2007 03:56 GMT
Yes. The combo box is only showing records that it retrieves from the Row
Source property. It will not delete records if the Row Source results change.
Because the combo box is bound to a particular field in your underlying
table, it will still show old records, assuming, of course, that form1's
Record Source is different to that of the combo's Row Source.
> But what if a record exists with a now inactive employee? Will the table
> still retain that employee even though it no longer shows up in the list?
[quoted text clipped - 16 lines]
> > >
> > > How can this work?