okay, i looked at your db; i'll answer you here rather than email, so others
may benefit.
the problem is in the combo box control properties' settings on "form2". you
added cboBuilder and set the RowSource to tBuilders, but didn't change any
other properties from the default values. tBuilders is a multi-field table,
so unless the primary key field is the very first field in the table (and it
is not, in this case), you can't get by with NOT changing the combo box
properties on the form. even if the primary key had been the first field in
tBuilders, i would still set up the combo box to show the names of the
builders, rather than the primary key - so you really can't get away without
tweaking the combo box settings.
change the combo box control settings as follows:
RowSource: SELECT BuilderID, Builder FROM tBuilders ORDER BY Builder;
<the Select statement goes all on one line in the property.>
ColumnCount: 2
ColumnWidths: 0";2"
<now the value of cboBuilders is the primary key field, as it should be, but
the user sees only the builders' names, again as it should be.>
ListWidth: 2.25"
also suggest you add the following code to cboBuilder's NotInList event
procedure, as
Me!cboBuilder.Undo
Me!cboBuilder.Dropdown
just makes things a little easier for your user.
also, just some general notes on your design:
- you turned off Name AutoCorrect in the database - very good.
- you related the "supporting" tables to the main data table correctly -
very good again.
- in each table, recommend you set the table's SubdatasheetName property to
[None]. see
http://allenbrowne.com/bug-09.html and scroll down to Tables:
SubdatasheetName, for more info.
- in each table, recommend you set the AllowZeroLength property of each Text
and Memo field to No. at the same link as above, scroll to Fields: Allow
Zero Length, for more info.
- you used the # sign in several fieldnames in your tables; recommend you
don't use anything except alpha characters, underscores, and numeric
characters (numerics only if you must, and not at the beginning of the
fieldname) in the name of ANYTHING that *you* name, in the database - so i
suggest you also change the name of your query "qContacts (B&C)", to
something like "qContacts_BandC".
- your tContacts does not have a primary key; you need to set one right
away. none of the fields or combinations of fields in the table make a good
candidate for pk, so recommend you add an Autonumber field (ContactID) to do
the job.
- you did a good job of normalizing your data in some respects: first and
last names in separate fields; different parts of address (street, city,
province) in different fields. all very good.
- however, you're breaking one of the rules of normalization by putting data
(phone types, such as "direct", "mobile", "fax", "pager") into fieldnames,
in tContacts. recommend that you move the Contacts' phone numbers into a
separate table, as
tblContactPhones
PhoneID (pk, Autonumber)
ContactID (foreign key from tblContacts)
PhoneTypeID (foreign key from tblPhoneTypes)
PhoneNumber
Notes
tblPhoneTypes
PhoneTypeID (pk)
TypeName (direct, mobile, fax, pager, etc)
email and radio number fields can be left in tContacts.
you did the same thing with the phone numbers in tBuilders. here i might let
it slide, (though it still breaks normalization rules) if no builder will
ever have more than one MainLine and FaxNumber (i really hate to say "never"
when talking about any business process...), and if most builders will have
both.
hth
bluemoir said:
Now I have things set up as I'd like them - I'm currently making all the
adjustments you instructed me to on a tabular autoform (so i can display more
than 1 record at a time). I have all the records displaying when I initially
switch to form view from design view but as soon as i try to requery with the
command button after selecting criteria in the combo box I get the followi ng
error: " Runtime Error 3420 - Object invalid or no longer set"
Right now to try and keep things simple i've only added 1 combo box to sort
by builder. In the query built through the forms record source I added all
the fields I wanted displayed (Is this correct?) and under the criteria for
Builder(Instead of vendor - im in the construction industry) I entered
Forms!FormName!cboBuilder Or Forms!FormName!cboBuilder Is Null
After doing this and saving it the form's record source reads as follows:
SELECT tContacts.LastName, tContacts.FirstName, tContacts.Direct,
tContacts.Ext, tContacts.Mobile, tContacts.[Mike#], tContacts.[Fax#],
tContacts.[Pager#], tContacts.[E-mail], tContacts.Builder,
tContacts.Category, tContacts.Department, tContacts.[Job Title],
tContacts.Details FROM tContacts WHERE
(((tContacts.Builder)=Forms!Form2!cboBuilder Or Forms!Form2!cboBuilder Is
Null));
Am I making an obvious mistake?
Thanks for your patience and efforts tina
Ross
tina said:
yes. open the form in design view. on the menu bar, click View | Field List.
highlight all the fields in the list, then drag them onto the Detail section
of the form and drop them.
i don't know what you mean by "sort". we've talking about *filtering* the
form's recordset. the *user* will choose values from the combo boxes'
droplists according to what records they want to see, and then click the
command button to requery the form's RecordSource. are you asking how to set
up the "droplist" of a combo box control?
hth
adding
all of
the displayed
in I'm
a see
into criteria,
as from
one