primary key recognition

Forum home » Delegate support and help forum » Microsoft Access Training and help » Primary key recognition

Primary key recognition

resolvedResolved · High Priority · Version 2016

Primary key recognition

Hi there,

In our database we have quarter and year information in many tables/ forms. These are built from combo boxes. The quarter and year fields are often part of the group of primary keys for our tables.


On our main switchboard is a combo box for year, and one for quarter. In the database I’ve managed to set up all the quarter and year fields to correspond to whatever is entered into the quarter and year combo boxes on the main switchboard. So where this is set for Q1, 2019 the same appears in all the other forms.

From the year / quarter combo box properties I used the expression builder (properties, data, control source) to look up the part of the switchboard to pull the info through from, in this case:

=[Forms]![frmSwitchboard]![Combo20]

Where Combo20 is the drop down for the year. The correct information appears in the forms nicely.

However…

The quarter and year fields form parts of the primary keys.

When entering data the forms seems to read the year and quarter as blank, thus won’t let the record be saved (because primary key information is incomplete). They aren’t blank, nor incomplete but rather the information pulled through isn’t being recognised.

I’ve tried a few things with no luck…

Any help grately appreciated! My deadline to share the database is tomorrow so not long to work this out :)

Tom

RE: Primary key recognition

Hi Tom,

Thank you for the forum question.

The primary key must be complete for saving the record.

The underlying data in a form must be updated by reguery the data.

This can be done by VBA.

Please find link below.


https://docs.microsoft.com/en-us/office/vba/api/access.form.requery

Kind regards

Jens Bonde
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

RE: Primary key recognition

Hi Jens,

Thank you so much for you speedy reply. I have this working now and am very pleased!

Best wishes,

Tom

RE: Primary key recognition

Great I am happy to hear you got it to work.

Kind regards

Jens Bonde
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

Wed 27 Mar 2019: Automatically marked as resolved.

 

Training courses

 

Training information:

See also:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Access tip:

Changing MS Programs Text Size

A handy way to increase or decrease the size of text in Microsoft Word, Microsoft PowerPoint, Microsoft FrontPage, or Microsoft Publisher, first, select the text you want to resize.

Then, to increase the font size, press CTRL+SHIFT+>.

To decrease the font size, press CTRL+SHIFT+<.

View all Access hints and tips


Server loaded in 0.11 secs.