How to 'hide' Lookup on form?

Ani

Registered User.
Local time
Today, 22:33
Joined
Mar 10, 2012
Messages
196
Hi Guys
Im trying to understand how the Lookup on a form works. MS Access help file is not helpful!
Field is 'Title', so just need Mr, Mrs, Miss, Ms, Dr in the combo box or list box.
Ive got as far as putting an Unbound box on the form and typing in the salutations. And deleted it!
Can you please tell me or point me to something - How do I make it only appear when I click on the text box in the form?
Cheers
Ani
 
Here is a link that will teach you about combo boxes. Scroll down to the tutorials on combo boxes. Post back if this does not provide you with what you are looking for.

http://www.datapigtechnologies.com/AccessMain.htm

Thanks Alan! Though I realised after I posted that it was another daft question!
:o
Tutorial much appreciated!:)
Ani
 
Hi Guys
Im trying to understand how the Lookup on a form works. MS Access help file is not helpful!
Field is 'Title', so just need Mr, Mrs, Miss, Ms, Dr in the combo box or list box.
Ive got as far as putting an Unbound box on the form and typing in the salutations. And deleted it!
Can you please tell me or point me to something - How do I make it only appear when I click on the text box in the form?
Cheers
Ani
To clear up something about Bound V Unbound. Unbound is used in most Database applications and a lot of Web Sites. With Unbound you have a text box on the screen for data entry. When the user is satisfied that the information is correct they click a Save Button and the information is written to the appropriate Table. You have to write the code to say where the information is being saved to. This is fairly standard for most applications.
MS Access is different in that it was written for bound objects. You simply select a Record Source (Table/Query) and create a form with text boxes to display/enter data. As you move away from a record the data is saved, automatically. No code required. The need to use unbound objects is fairly limited. A calculated field would be displayed in an unbound Text box where the information is not saved.
You will see a lot of questions about code to save information in unbound situations. These questions arise from lots of problems. Access is designed for Bound forms so I suggest that you go with the flow.

You mentioned unbound box in your question. I believe you were referring to a Combo box. The Combo should be bound to a Table. As an example you may have the following structure for a Table.

tblClient
ClientPK Autonumber
SalutationFK as Long
ClientName as Text

A lookup Table would be

tblSalutation
SalutationPK as Autonumber
Salutation as Text

Your Combo Box’s Control Source would be SalutationFK.

The Row Source would be a Select Query
SELECT tblSalutation.SalutationPK, tblSalutation.Salutation FROM tblSalutation
ORDER BY tblSalutation.Salutation; UNTESTED.
You can build this statement by clicking on the ellipses … (Three Dots) on the far right hand side.
Column Count would be 2
Bound Column would be 1 (SalutationPK)
Column Widths would be 0,2.5. Adjust to suit.

What this does is stores the Primary Key from tblSalutation to the Foreign Key of tblClient.

On the Forms the combo will display the Text, e.g. Dr. Sir etc while the Table will store and display the Primary Key which is a number.

This appears to be an over kill for such a simple situation, however the theory is there for all Look Ups.

Hope this helps.
 

This appears to be an over kill for such a simple situation, however the theory is there for all Look Ups.

Hope this helps.


Brilliant...Thanks for that really clear explanation Rain....it covers questions I was unable to ask! Im sure I will use that explanation several times whilst setting my look up bits on my forms. I am so glad that I am starting with things as simple as Mr, Mrs, Dr and not trying to use several tables/queries to display more!
Ani :D
 

Users who are viewing this thread

Back
Top Bottom