trouble with forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a form from a table called 'Items'. I have one field on the
form though where I want the vendor name from the 'Vendor' table to appear
when I enter a vendor code number from the 'Items' table. I can get it to
work , but then the form won't let me enter new records. What do I need to do
to get it to let me be able to add new records?
 
idcreek said:
I have created a form from a table called 'Items'. I have one field on the
form though where I want the vendor name from the 'Vendor' table to appear
when I enter a vendor code number from the 'Items' table. I can get it to
work , but then the form won't let me enter new records. What do I need to do
to get it to let me be able to add new records?
 
Hi, IDCreek.

It sounds to me that your form's RecordSource is a non-updateable query.
This can have many possible causes (Google will find a white paper on the
subject), but one common way is including the primary key from the one side
of a one-to-many relationship instead of the foreign key.

For example, this would be the situation if you'd included the Vendor # from
the Vendors table in your query. Instead, include the corresponding foreign
key from Items.

Then you can use a combo box on your form to select the Vendor #. The
easiest way to add it is with the wizard. Toggle the Wizard on on the
Toolbox (depress the button with the wand and stars), tell Access to look up
records in a table or query, select both the Vendor # and the Vendor Name
fields, and accept the default of Hide Key Field (recommended), and tell
Access the name of the numeric field in which to store the ID # from the
selected row.

This arrangement allows the user to select by name, but efficiently store
only the vendor #. If you wish to *display* the number as well, set a
textbox using the column property of the combo box:

=MyComboBox.Column(0)

Hope that helps.
Sprinks
 
I'm not sure about what your telling me. I'm new to Access, but I don't have
a primary key in either table. The vendor number is in both tables. I need to
be able to enter new records to the 'Items' table through the form, but with
the vendor name field in the form it won't allow me to do so.
 
Back
Top