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

Questions regarding how to autofill and autonumber a form from a table.

13
Hello, I'm very new to access (about a week I've been working on this database) and am trying to make a database to track jobs for a company I work for. I've got the layout side of access laid out fairly well, but I'm having trouble with the programming side of Access. I've got one main table that the information will be pulling from called tblCustomers. This contains the information that I want to display on the form I've attached. Basically I'd like to use a drop down menu under "customer name" on the form. When I select a particular company I need the other related information such as "Customer ID, Contact, Street, City, State, and Zip Code" to automatically fill from the information contained in tblCustomers. This is what I'd like it to do, however I'm somewhat lost on how to go about getting that working. I've read that the dlookup command should do what I need, but again, I'm not sure. This is why I've come to theScripts, please help. I appreciate any information you can give, or point me toward. One other item I'd like to get to work after getting the autofill to work is that I'd like the Job # field to automatically fill out with a unique number within a range of positive numbers, say 5 decimal places 0 - 99999? Thank you again for any help you can provide.

Picture of the Form.



- James
Oct 31 '07 #1
14 3453
794613
13
Alright, slowly but surely I'm making some progress. I was able to get the Customer ID to autofill, although it has started to fill the Contact information with the same info as the Customer ID. Eitherway, how would I go about setting another command in the same event? Is there a divider I can use, or simply another line to type the next part of the code?

Thank you for any help you can provide,
- Jim
Oct 31 '07 #2
nico5038
3,080 Expert 2GB
First you need to think about the construction of your tables and their relations.
Assume an Orderform, this will be based on a tblOrder, but also have a relation to a Customer.
To get the Customer details you can easily add a subform that's linked to the CustomerID of the tblOrder and than Access will synchronize the Customerdata.

When you make the CustomerID on the frmOrder a combobox to lookup Customers from your customer table, the data of the subform will also change after the selection of another Customer.

Perhaps it's worthwhile to look into the Northwind sample database that comes with Access and/or can be downloaded from the MS site.

Nic;o)
Oct 31 '07 #3
794613
13
Thanks for your help Nic, I was able to get the sub form to work (wasn't aware of a subform option). Thank you very much for your help. Now I need to figure out how to do an autonumber system that has a set number of decimal places and counts in increments and will not lose count after a database compact and repair. The number needs to be 5-6 digits in length, non-repeating, etc. It also needs to start with 0's in blank digit areas, ex. instead of just the number 1, it needs to be 00001. These will become job numbers. If you could point me in the right direction in that regard, I'd appreciate it. Thank you again.

Here's the updated form.

Nov 1 '07 #4
794613
13
Also, is there a way to make the autonumber field start from a certain value? So instead of autonumbering starting from 1, it could start from say, 100, or 151? Thanks.

- Jim
Nov 1 '07 #5
nico5038
3,080 Expert 2GB
I've created in the past a sample database to show a controlled number insert:
http://www.geocities.com/nico5038/xC...Insert2000.zip

Nic;o)
Nov 1 '07 #6
794613
13
Nic,

I appreciate all the help you've given as it has helped me quite a bit. I come again to ask your help with what I hope to be my final question for some time. The following is what I'm trying to accomplish:

1.) I want to create a table that will have 6 fields, and 5 subforms. The first field will be a date field, and the next 5 will be Job-1 through Job-5. I'd like Job-1 through 5 fields to be combo boxes that pull the job number from the job table. Subforms 1 through 5 will each be located under each Job drop down combo box. The idea is that by selecting a job number in job number 1, the subform will display the necessary information that I want from the Job table. I can clarify if necessary. Eitherway, the idea of this is that I will create a form for the Daily table (Daily Worksheet) and I'll be able to select our current jobs by job number. This way the employees working in the shop have a daily list of what jobs they are working on and such. I don't know if what I need to do is even possible. I'm sure it's something basic I'm missing. I've setup the combo boxes on the Daily table to pull from the job menu. And I've added a subform with the data from the Job Tracker. But when selecting the job number, the subform isn't automatically updated. I'd be willing to upload the database if someone could take a look at my work and see what needs to be done.

Thank you very much,
- James
Nov 6 '07 #7
nico5038
3,080 Expert 2GB
You'll need to manually link each subform with the appropriate combobox.
Just single-click the subform and open the Data tab of the properties.
place the comboname in the Main linkage field and the corresponding key in the subform in the Child linkage field.

Nic;o)
Nov 6 '07 #8
794613
13
Nic,

Thank you for all your help. I went ahead and created my Daily form from the Daily table. The Daily table has the following fields:

date
jobnumber1
jobnumber2
jobnumber3
jobnumber4
jobnumber5

jobnumber1 is a combo box that pulls info from my Jobs table. That part of the form is working well. It has a lookup column that I set up that searches by Job Number and Customer Name. The issue I have is even though (as far as I know) the form and subform are linked correctly, the data is not automatically filled in the job subform after selecting a job number.

Thank you for your help,
- Jim
Nov 7 '07 #9
nico5038
3,080 Expert 2GB
Make sure that the bound column (normally col 1) is returning the proper value to link the subform.
Manually linking works always, at least with the proper values (also check the datatype of both fields!)

Nic;o)
Nov 7 '07 #10
794613
13
Hello Nic,

Thank you again for your help. I hate to keep using this same original post to ask other questions, but no one seems to respond to my other threads. Any how, I've gotten my drop down daily worksheet to work thanks to you. It was in fact the bound column that was giving me issues. The new issue I have should be the last for a bit. This is what I've got:

The Job Tracking form (Jobs) has a "jobnumber" field that I'd like to use an autonumber (unique) in incremental mode. That by itself isn't an issue. However if I switch that job number to an autonumber field, I cannot properly link my Daily Worksheet form (Daily) from each look up column (combo box). When I change the data type to number for example, it just doesn't seem to work. Can you give me an overview of how to properly setup the following:

- Autonumber field for Job Number in the Jobs Table/Form.
- 3 separate combo boxes pulling info into subforms.
- What data type needs to be selected for those 3 combo boxes?

Thank you Nic, if you need more information, just let me know.

- Jim
Nov 9 '07 #11
nico5038
3,080 Expert 2GB
Changing a datatype "down the road" isn't easy.
Not only the tablefield needs to be changed, but also the fields used on the forms.

In general a "rebuild" of forms and reports is the best solution to make sure nothing is forgotten. Guess you found out why I spend lots of time with validating my table design... :-)

In general I wouldn't use an autonumber for a "visible" Jobnumber. For me the autonumber is normally "hidden" for the user as it won't allow much flexibility in setting ranges....

Nic;o)
Nov 9 '07 #12
794613
13
Nic;o),

From my research with access I understand the issue with using a visible autonumber field, but I cannot seem to find a better work around. What would you do to create an incremental, "auto number", with formatting options for a job number?

Thanks,
- James
Nov 12 '07 #13
794613
13
Hello, I've got an update to my current issue. I used the DMax function to add a number in sequence to the jobnumber. That is working, here is the code I am using.

jobnumber = DMax("JobNumber", "tblJobs") + 1

And so far this is working. The issue I have deals with where the best location is to insert the code in. I'd like the number to be updated before any data is entered into the new record. Or even better, a fail safe where it requires user input in the form of a button plus a warning that clicking this button will make a change to the job number. I'm trying to keep sequential numbers to keep track of the job number, but at the same time make it so it's not something that will be changed accidentally.

- Jim
Nov 12 '07 #14
nico5038
3,080 Expert 2GB
I generally use the created number to INSERT a new row and then open an INSERT form (that's effectively an update form) using the created key for the stCriteria filter.
The only difference with an ordinary Insert form is that the form's Cancel button will delete the record...

Nic;o)
Nov 12 '07 #15

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

Similar topics

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>...
13
by: Eric E | last post by:
Two questions regarding ODBC. 1) I am connecting to a MySQL database using the following code: Function LoginToMySQL(sUsername As String, sPW As String) As Boolean Dim dbMySQL As Database Dim...
26
by: jimfortune | last post by:
Sometimes I use Autonumber fields for ID fields. Furthermore, sometimes I use those same fields in orderdetail type tables. So it's important in that case that once an autonumber key value is...
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...
10
by: sandraz444 | last post by:
I have an expression in the query under my form to autofill the date under a certain condition but it wont write to the underlying table?? The date shows in the form but not the table. Does anyone...
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...
2
by: Bob Alston | last post by:
Recently I have been helping a nonprofit modify a system built in Access, that they acquired from another nonprofit. I am doing this as a volunteer. I would like your perspective on two...
2
by: sbrown1002 | last post by:
I have two forms Forms#1 is (Inventory Register) Fields: OasisID (Text) RegisterID (AutoNumber) Item Description (Memo) Form#2 is (Item Transfered) OasisID...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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
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
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
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,...

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.