473,395 Members | 1,386 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Autofill

I have created a database that can do 99% of what i want to do.
the 1% is i see as a simple thing (it can be done in asp php ect but i can't figure out how to do it in Access!).

In the data base is a table called table1 it contains details of customers
there is a table called table2 which contains agreements with two bits of information from table 1 the customers name and an ID No (both in separate fields) and other fields such as price agree No etc.

When set up both the name and ID No in table to is entered via drop down boxes (taken from table 1) what i would like to do is as the name is chosen the ID No box takes the related ID No from Table 1 and adds it to table 2.
i have seen some thing similar in the Northwind ensample (chose company info and the email is auto added to its box) but try as I might I can not find how its done code? Macro? or by expression. Every thing else I have done in my DB i have found by reverse engineering or through books but this problem I can not find a simple explanation.

I have attached the DB file again this time I hope it will work
Attached Images
File Type: jpg exsample.jpg (15.3 KB, 88 views)
Attached Files
File Type: zip Database2.zip (17.4 KB, 117 views)
File Type: zip db2.zip (26.4 KB, 130 views)
Apr 30 '10 #1

✓ answered by Jim Doherty

@thanatosuk
Yes I fully understand you it is not rocket science sir!

In plain english, the example I gave you does NOT rely on passing the value by code because both combo and listbox are bound to the relevant control they seek to pass a value too.

Having now looked at your db I will deal specifically with what you have (you can maybe understand the contribution I made to you and 'reverse engineer' it in your own time)

In your Form2 your dropdown named 'full' has two columns the first column is ID which is hidden because the columnwidth property is set to zero thus displaying to you only the second column.

You want to pass the value of the ID selected in the 'full' control to the [ID No] control dropdown on your form. To do this in your scenario you need to look at the afterupdate property for the 'full' combobox and insert a code event procedure that is fired when the 'full' combo is updated. The code for that is logical namely, it will only pass a value if there is a value to pass

Do you understand now?

Expand|Select|Wrap|Line Numbers
  1. If IsNull(Me!full) Then
  2.    'do nothing because we are null here on the true side
  3. Else
  4.   'pass the value because something exists in the full combo
  5.  Me![ID No]=Me!full
  6. End if

10 1474
missinglinq
3,532 Expert 2GB
I'm sorry you're having problems explaining your problem, but your attached image doesn't appear large enough on my monitor to make out any detail. And when going to unzip your attached "database" Winzip pops an error "No file to extract."

You need to try again and you need to give a written explanation of your problem, not simply posting a graphic.

Linq ;0)>

Modertor
May 1 '10 #2
Jim Doherty
897 Expert 512MB
@thanatosuk
From what I can see from your JPG file screen shot you are wanting to grab ID values of one field and maybe store in another and generally trying to get your head around the concepts of combo dropdowns and values they hold etc.

Take a look at this simple db and pull it apart to gain some extra knowledge. It is a very simple thing to demonstrate a table of people and a table of jobs where you assign a particular person to a particular job based on a query that services a form. The form has a query as its recordsource, look how that works then look at listbox and dropdowns to see if it helps you a little. Notice how you cannot click on the listboxs or combos unless a job type is selected first and so on view the simple VBA code behind the form to give you an idea.

It is not the be all and end all in design, but demonstrates a different approach to consider as you progress your learning

Welcome to Bytes :)
Attached Files
File Type: zip thanatosuk.zip (19.2 KB, 134 views)
May 1 '10 #3
Right I cannot find any info in your database that shows me how it is done there is nothing I can see in the code to show how, when you chose the Person assigned in the bottom box, that explains or shows where the person id is entered this is the problem with asking questions I know it can be done cos I see it happening in your DB but how is it done?? Where in the code is the command that will in plain English: "when you pick Donald put his id no in the id no box" do you understand now?


Expand|Select|Wrap|Line Numbers
  1. Private Sub cboInformation_AfterUpdate()
  2. On Error Resume Next
  3. If Me.Dirty Then Me.Dirty = False
  4. End Sub
  5.  
  6. Private Sub cboInformation_GotFocus()
  7. On Error Resume Next
  8. If IsNull(Me!JobType) Then
  9. DoCmd.Beep
  10. MsgBox "Choose a job type first before selecting a person", vbInformation, "System Message"
  11. Me!JobType.SetFocus
  12. End If
  13.  
  14.  
  15. End Sub
  16.  
  17. Private Sub JobType_AfterUpdate()
  18. On Error Resume Next
  19. If Me.Dirty Then Me.Dirty = False
  20.  
  21. End Sub
  22.  
  23. Private Sub lstPeople_AfterUpdate()
  24. On Error Resume Next
  25. If Me.Dirty Then Me.Dirty = False
  26. End Sub
  27.  
  28. Private Sub lstPeople_GotFocus()
  29. On Error Resume Next
  30. If IsNull(Me!JobType) Then
  31. Me!JobType.SetFocus
  32. End If
  33.  
  34. End Sub
May 2 '10 #4
robjens
37
Dude this is extremely easy.

Make sure to include the Id in the first dropdown but hide the column, so two columns Id and Name with their width to 0cm;2cm or something. Bound column is Id. Then you take the OnChange event and set that value

Expand|Select|Wrap|Line Numbers
  1. Private Sub lstName_Change()
  2. Me.lstId.Value = Me.lstName.Value
  3. End Sub
May 2 '10 #5
Jim Doherty
897 Expert 512MB
@thanatosuk
Yes I fully understand you it is not rocket science sir!

In plain english, the example I gave you does NOT rely on passing the value by code because both combo and listbox are bound to the relevant control they seek to pass a value too.

Having now looked at your db I will deal specifically with what you have (you can maybe understand the contribution I made to you and 'reverse engineer' it in your own time)

In your Form2 your dropdown named 'full' has two columns the first column is ID which is hidden because the columnwidth property is set to zero thus displaying to you only the second column.

You want to pass the value of the ID selected in the 'full' control to the [ID No] control dropdown on your form. To do this in your scenario you need to look at the afterupdate property for the 'full' combobox and insert a code event procedure that is fired when the 'full' combo is updated. The code for that is logical namely, it will only pass a value if there is a value to pass

Do you understand now?

Expand|Select|Wrap|Line Numbers
  1. If IsNull(Me!full) Then
  2.    'do nothing because we are null here on the true side
  3. Else
  4.   'pass the value because something exists in the full combo
  5.  Me![ID No]=Me!full
  6. End if
May 2 '10 #6
Thanks Jim Doherty, your explanation of how to solve my problem was excellent. All I have to do is change a few bits of data in the db and enter the code you showed me.
It works, and the one thing that bugs me about this problem I could not find the solution in any of the so called bibles for access!


Thanks again
May 2 '10 #7
NeoPa
32,556 Expert Mod 16PB
a simple question no one can answer! auto fill
I've changed the title of this thread to comply with the site rules.

Apart from being entirely useless as a question, it is also very obviously illogical. If it were simple, not only would everyone be able to answer it, but you wouldn't need to post it in the first place. As a general rule, one can only decide if something is simple when one knows what that something is. When an answer exists, then it can be categorised.

Please try to give a little more consideration to the rules (common sense mostly) before posting a question in future.

Administrator.
May 2 '10 #8
Jim Doherty
897 Expert 512MB
@thanatosuk
Glad I could help you :)
May 2 '10 #9
in reply to Neopa
I made the question simple because the problem I had was in a large DB, and for 4 days I could not find the answer to the problem. Either in Books on Access or on other forums only Jim took the time to answer the question with patience and in a way that was understandable. from his answer i have learnt more than just the solution that i wanted. one considerate person who looked at the problem has improved my ability 10 fold.
As to your statement ‘it is also very obviously illogical’ is blown out of the water by jims solution I knew it was possible to do I just did not know how.
May 2 '10 #10
NeoPa
32,556 Expert Mod 16PB
thanatosuk: As to your statement ‘it is also very obviously illogical’ is blown out of the water by jims solution I knew it was possible to do I just did not know how.
You misunderstand my point.

I was saying that it is illogical to indicate a question is simple when you don't already know the answer. A simple question is a question that is easily answered. As you don't (didn't) yet have an answer you are not in a position to know whether or not it is simple.

As a point of interest, people don't generally appreciate being told that their efforts to provide a solution are of a basic nature - especially by someone who is in a position where they need to ask it. If you give that a little thought you shouldn't find it too complicated a point to grasp I'm sure.
May 3 '10 #11

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

Similar topics

0
by: Chris Sharman | last post by:
I'd like to design my pages to work cooperatively with browser autofill features. I've loked around, but can't find any good documentation on supported/unsupported field names...
1
by: shortbackandsides.no | last post by:
I'm having a lot of difficulty trying to persuade the Google toolbar autofill to act consistently, for example ======================= <html><head> <title>autofill test</title> </head><body>...
0
by: David Portabella | last post by:
Hello, I am a doing a survey about Autofill Web Forms softwares. Usually, they all collect information of the user once during the set-up phase (user knowledge base). Then, when the user...
3
by: Anks | last post by:
Hi All, A user can control the AutoFill option by enabling / disabling the Remember Passwords option in Options - Privacy - Saved Passwords section. But is it possible to disable this option...
0
by: Ray Holtz | last post by:
Is it possible to autofill a field based on what is entered into another field in a form? My form has an employee field, and department field. In an Items Table, I have fields FldEmployee, and...
1
by: Nick J | last post by:
Hi, I remember at one point access would autofill a text box when filtering by form, Like for example as I would type it would come up with matching records, similar to AutoComplete in Internet...
2
by: Andre Ranieri | last post by:
I'm retouching our corporate web site that, among other things, allows customers to log in and pay their invoices online. I noticed that on the checkout page, the credit card number textbox...
4
by: HTS | last post by:
I have written a membership database application (PHP + mySQL) and need to prevent autofill from filling in fields in a member record edit form. I know I can turn off autoFill in my browsers, I...
1
by: Rissoman | last post by:
Hello, I have an issue were I have a zipcode textbox in an atlas ajax updatepanel. When you tab out of the zip textbox and the shipping is calculated. I know this works perfect! Then a user...
0
by: Randy | last post by:
Hi, I have some comboboxes that are created dynamically at run time based on user actions. I found a procedure on a message board to autofill the combobox text from the dataview that the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.