473,388 Members | 1,335 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,388 software developers and data experts.

Unable to autofill form fields

Hello all

I am now at the point of going mad as I have been trying to do the below for 2 weeks now so I am desperate need of some help.

I have set up a form with various amounts of combo and text boxes. One of the combo boxes called Username, consits of a dropdown menu from which a user can select Lastname,Firstname ( This filed uses a expression to pull the information together from a table which is linked from a AS400 server, where Lastname and Firstname exists in seperate fields).

Once this username is selected I want other text boxes to automatically fill with the rest of the data corresponding to the slected username like Employee number,Address,phone number,job title etc.

I have tried all sorts of workmethods,differerent code and so forth, but just cannot seem to get it to work.(You would think that a procedure like this would be a common thing to do in Access, but hey I am wrong)

Any help on this would be sooo much appreciated

Thanks in advance
Oct 26 '06 #1
19 6709
pks00
280 Expert 100+
A simple solution might be to create a bounded form to your table (linked)
On selection from combo, load the record (u can use Me.Filter)
Oct 26 '06 #2
Hi

Thank you very much for your reply. I am new to Access and VBA, so this might take a while , but I will give your suggestion a very good go and see if it works.

Thanks a lot
Oct 26 '06 #3
NeoPa
32,556 Expert Mod 16PB
Have you tried a form with a subform?
Oct 26 '06 #4
Hi there

Yes I did, but either it just did not work or I did something wrong along the line. I also tried using hidden columns, even a worse result.
Oct 26 '06 #5
Right, hold on guys

I have managed to get hold of someone who actually got this to work. I will get him to explain the procedure he followed and then I will post the procedure on this discussion. Thanks for all your help!!
Oct 26 '06 #6
MMcCarthy
14,534 Expert Mod 8TB

I have set up a form with various amounts of combo and text boxes. One of the combo boxes called Username, consits of a dropdown menu from which a user can select Lastname,Firstname ( This filed uses a expression to pull the information together from a table which is linked from a AS400 server, where Lastname and Firstname exists in seperate fields).
Does this correspond exactly to a field value in the record you want to populate


Once this username is selected I want other text boxes to automatically fill with the rest of the data corresponding to the slected username like Employee number,Address,phone number,job title etc.
Assuming the answer to the first question is yes.

Set up the form with the record source set to all records of this type.

Then delete the record source.

in the on click event of the search button put ..

Me.RecordSource = "SELECT [Employee number], EmployeeName, Address, [phone number], [job title] FROM tableName WHERE EmployeeName='" & Me.Username & "'"
Oct 27 '06 #7
HI there

Well, the first and last name is two different fields in a employee table(Pulled together via an expression).These fileds only changes if a employee leaves or joines the company. The rest of all the fileds on the form I want to autopopulate are all located in the same table as above.

I will give your suggestion a go and see what happens. Fingers crossed.

Thanks
Nov 1 '06 #8
I have managed to get hold of someone who actually got this to work. I will get him to explain the procedure he followed and then I will post the procedure on this discussion. Thanks for all your help!!
I am attempting to do the same thing as you. You said above that you solved it. What was the method? Thanks.
Nov 3 '06 #9
Hi there

I thought I did, but not sorry. In a way I am glad to hear I am not the only one. I have now been struggling with this for a very long time. Writing expressions,macros,VBA code etc. I just cant believe that this is such a hard thing to do. I will keep on trying though and when I do eventually find the solution I will make sure to post it to this thread. Please do the same if you find it.....

Thanks (I think I have now developed a nervous twitch from this issue.....:-) )
Nov 3 '06 #10
Just a note to pks00, thanks for advice. I have tried to do what you suggested, but got so lost trying it. Also to mmcarthy , I have also tried what you suggested, but cannot even get past the following you suggested :

Set up the form with the record source set to all records of this type.

Then delete the record source.


Dont quite understand the working behind that. Sorry if I am sounding a bit of a thicky, but my brain is fried after spending hours after hours on this.

Thanks
Nov 3 '06 #11
Hi guys

Right I have descided to put the following together :( Unfortunately I have the same posted on another thread as I did a bit of a booboo when I first started listing here and did not mean to post the same problem twice)

Here is a explanation of what I have :

Tablename : Employees
Field name 1 : Employeenumber
Field name 2 : EmployeeFirstName
Field name 3 : EmployeeLastName
Field name 4 : AddressLine1
Field name 5 : AddressLine2
Field name 6 : AddressLine3
Field name 7 : HomeTelephone

On the form I have a ComboBox which dispalys the username(This is done via an expresison which pulls together Filedname 1 & Fieldname 2. ) The users is then suppose to select a name from the dropdown list.

Once the name has been selected, the rest of the Textboxes which corresponds to Fieldnames 1,4,5,6,7 should autopopulate with the data corresponding to the username selected.

Hope this makes more sense of what I want to achieve.

Thanks
Nov 3 '06 #12
NeoPa
32,556 Expert Mod 16PB
Then delete the record source.

Dont quite understand the working behind that.
I think what Mary means is :-
Go to design view of the form and clear the current value in the 'Recourd Source' property.
Then, as per the rest of her post, this will be set when necessary, and correctly for the current selection(s), with the code she's posted for you.
Nov 3 '06 #13
Hi there

Good news, I have done it!! And in a very simple way as well. Here is what I did:

- I created a new query on the table I want to get the data from.
- I then wrote an expression for this query to join the Lastname and Firstname fields as follows:

- FullName: Trim(Tablename.Fieldname for surname) & " , " & Trim([Fieldname for forename])

- I then also included all the fields in the query that will be autofilling the Textboxes I have created on the form.

- I then changed the RecordSource on the form properties to use the new created query .

- For the full name as above, I used a ComboBox and then set the properties for that ComboBox's control source to use the expression I created as above. I then set the following code for the AfterUpdate as follows :

Private Sub (Your combo box name)_AfterUpdate()
Dim rs As Object

Set rs = Me.Recordset.Clone
Dim Test As String
Test = "[The name of the expresion to combine first and last name] = '" & Me![Your combo box name] & "'"
rs.FindFirst Test
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

- I then created all the nessecary TextBoxes I needed and set each individual TextBox's control source properties to point to the corresponding field in the expression above.(This could be selected from the field names presented to you when you click on the dropdown menu for the source).


Presto!!

Now when I select a username, the rest of the textboxes automatically updates with the user's details.

So to all who have helped me, thank you very much.

Also to Sinunred, give this a go, should work fine now.

Thanks a lot guys!
Nov 6 '06 #14
MMcCarthy
14,534 Expert Mod 8TB

Good news, I have done it!!
Glad to hear it. It's great when posters take our suggestions and work to come up with there own solutions. That's how your learn.

If you have any further problems, please post them and we'll do what we can to help.
Nov 7 '06 #15
Thank you very much, all the help much appreciated and I hoped I helped others in the process

:-)
Nov 7 '06 #16
MMcCarthy
14,534 Expert Mod 8TB
Thank you very much, all the help much appreciated and I hoped I helped others in the process

:-)
That's what theScripts is all about.
Nov 7 '06 #17
lefr
3
... RecordSource on the form properties to use the new created query .
I'm having a little trouble with this statement. I have been also struggling with this for a while, but if I understand you correctly, when you refer to form properties, are you referring to the properties of the combo box itself? If so, I only show a Control Source and a Row Source under the Data Tab. I can't find the "Record Source".

Thanks
Nov 29 '06 #18
MMcCarthy
14,534 Expert Mod 8TB
I'm having a little trouble with this statement. I have been also struggling with this for a while, but if I understand you correctly, when you refer to form properties, are you referring to the properties of the combo box itself? If so, I only show a Control Source and a Row Source under the Data Tab. I can't find the "Record Source".

Thanks
No, the form itself has properties. With the properties open go to the top left hand corner of the window in form design view and there is a little black square in the corner of the frame. Click on that and the properties will change to form properties where you will see things like Record Source.

Mary
Dec 6 '06 #19
Thank you for the reply McCarthy.

Yip thats correct, each form does have it's own properties.
Dec 7 '06 #20

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...
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...
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...
6
by: bloukopkoggelmander | last post by:
All I am new to this site and hopefully would have a good time here. I am new to Microsoft Access and VBA and am currently involved in a project to create a new database for one of our company...
8
by: tess | last post by:
I have: table 1 - tblLeadInfo which includes a salesman ID field table 2 - tbllkpSalesman with all zips in the state and a Salesman assigned to that area. I have a form based on table #1 When...
13
by: BASSPU03 | last post by:
Hello, folks. This is my first post and I only began to work extensively with Access about 3 weeks ago. I'm running Access 2003 on Windows XP. I'd like a textbox in subform2 to reflect the value...
1
by: Nik Coughlin | last post by:
I'm doing some ajax validation on form fields, using the form change event. If I click Autofill in the Google Toolbar, fields are filled out but the change event is never fired, so the validation...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.