By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,121 Members | 1,723 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,121 IT Pros & Developers. It's quick & easy.

Retrival of records from a table

P: 10
Hi I am new using Access database. I have created a table with several fields like (letter categrory, letter type, letter name etc) in access, using forms and inserted few records in my table. now I wanted to know like if i type in an existing letter name(already placed in a record) in the text field provided for letter name in my form, I need to retrive all other fields of that particular record.

say for example, my record has
Letter categrory : intr
Letter type : haaad
Letter Name : abcdef

Now if i type in abcdef for letter name in my forms window, the forms window should display values of letter type and letter name.
how do i do this
Jan 29 '09 #1
Share this Question
Share on Google+
12 Replies


P: 83
@shreeks
Here is a link that could be useful to you.

http://www.allenbrowne.com/casu-22.html
Jan 29 '09 #2

Expert 100+
P: 1,287
Well, here are some suggestions if you don't want to read a whole book.

If you are ok with your user having to input the exact letter name to search, you can make a subform to display the records and set its Link Master Fields to the input textbox and the Link Child Fields to LetterName. This is a bit restrictive.

Another way would be to have the user type in a value and click a search button. The code in the search button is like:
Expand|Select|Wrap|Line Numbers
  1. subformControlName.Form.Filter = "LetterName LIKE '" _
  2. & [inputTxtBox] & "*'"
  3. subformControlName.Form.FilterOn = True
So, when they click search, your subform now only displays those records that have a Letter Name that starts with what was entered in the text box.
Later on, you can get fancy and update the subform whenever a letter is typed in the input, like an autocomplete, depending on how large your recordset is.
Jan 29 '09 #3

P: 10
I Created another form say 2nd form with Letter name, and made my original form with letter type, letter category and letter name as the subform. Acutually my Letter name field is set as primary key. Now i entered few values in the table and I am able to retrive the values of the table using my 2nd form by entering the letter name already existing in my table and I am able to see all the values in the subform.
let us say my table has
Letter name letter type letter category
andy aaa 123
sam bbb 333
rob ccc 324

when i enter 'andy' into the letter name i am able to see 'aaa' and '123' in my subform.
but now i want to edit this data in my subform. I want to change 'aaa' and '123' values in my subform directly and this change should reflect in my table.
can I do that, or is there any other method that i can work on that performs this job??
Feb 2 '09 #4

Expert 100+
P: 1,287
The data in the subform is the table data, so if you change it in the subform, it will be updated in the table. What is preventing you from changing the data in the subform now?
Feb 2 '09 #5

P: 10
Acutually I have setup "Primary Key" on Letter Name field. So it is popping out a message like... " the changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the fields that contain duplicate data, remove the index or redefine the index to permit duplicate entries and try again"

but I dont want duplicates in my table....
Feb 2 '09 #6

Expert 100+
P: 1,287
You get this message when you try to change the data in the subform? Change one field at a time until you can tell what field is violating the restrictions.
Feb 2 '09 #7

P: 10
Acutully here I am not entering the new data ... i am trying to edit the data which is popped up from the table in the subform.

I am not being allowed to edit any data there... I am getting the message as soon as I am trying to click my mouse anywhere on the subform.
Feb 2 '09 #8

Expert 100+
P: 1,287
What code are you using to show the values in the subform?
Feb 2 '09 #9

P: 10
I didnt write any code there... I just dragged one form into another in design view .... one of my forms has just letter name in it and other form has letter name, letter type and letter description in it.. i dragged the second form and placed it in the first form... so when i type in a letter name in my first form.. the corrosponding record values are being displayed in the subform.....
so I haven't written any code there...
Could you please help me out writing out the code(please be very elobrative beccause this is my first time working on access)......
Feb 2 '09 #10

Expert 100+
P: 1,287
Is your first form bound to a recordset? The field where you type in a letter name on your form should not be updating your table.
Feb 2 '09 #11

P: 10
yes my first form is also bound to a record set. yes it is not updating my table..
Feb 2 '09 #12

Expert 100+
P: 1,287
Try removing the recordset source from the main form. It doesn't need one. Make sure that the master field of the subform is set to your input box.
Feb 2 '09 #13

Post your reply

Sign in to post your reply or Sign up for a free account.