Generate Custom Id Field

Sep 29, 2004

Hello Again,

I have an ID field that I want a custom ID generated based on Name, Phone Number & Record Number.

Here is the code I'm currently using....

'User moved out of supplier name field
Public Sub SupplierName_LostFocus()
If Me.NewRecord = True Then 'If user adidng new supplier
SupplierNameTemp = UCase$(Left$(SupplierName, 3)) 'Store 3 characters from supplier name
End If
nd Sub

'User moved out of suppliers phone number field
Public Sub SupplierPhoneNo_LostFocus()
If Me.NewRecord Then 'If adding a new supplier
supplierPhoneNoTemp = UCase$(Right$(SupplierPhoneNo, 4)) 'Get 4 right characters of phone #
End If
End Sub

I then have a procedure which combines the two strings such as....

Private Sub GenerateSupplierId()
SupplierID=SupplierNameTemp+SupplierPhoneNoTemp
End Sub

The problem is when I check the SupplierPhoneNoTemp & the SupplierNameTemp within the GenerateSupplierID procedure. The contain no information meaning the SupplierID will have nothing as well.

However, when I check SupplierNameTemp within the Public Sub SupplierName_LostFocus() & SupplierPhoneNoTemp within Public Sub SupplierPhoneNo_LostFocus(). They both contain the proper info. It seems they loose this information when moving outside their procedures.

Does anyone know why this would happen & how I could fix this?

Thanks.

View Replies


ADVERTISEMENT

Forms :: Generate Custom Form Based On Query Results

Dec 11, 2013

I'm trying to track daily production at a manufacturing company running many different processes at different locations each running multiple parallel "lines." The tricky part is that the number of lines running and the shift schedules e.g. 2shifts 10hrs/day 4days/week or 3shifts 8hrs/day 5days/week change frequently for each process.

Right now I have a form for process data that specifies the schedule and number of lines running each day. Then I'm running an append query to a "production" table that generates blank production records associated with each item made in each process for the correct shift/line combinations.

Up to now I've been manually changing the date on the append query each time I run it. Then I have a seperate query for each process that pulls out the production records for each day. My problem is that the preferred interface for production data entry is a spreadsheet with the following layout:

--------DAYS LINE 1 DAYS LINE 2 SWING LINE 1 SWING LINE 2
ITEM 1 100
ITEM 2 2250
ITEM 3

which changes each time the shift/line schedule changes for each process. The only way to achieve this layout I know of is a crosstab query which isn't updateable. Ideally, each day the manager will specify the shift schedules and forms will be automatically generated with the correct structure and sent to the process supervisors. I'm open to different form layouts and even redesigning the database completely.

View 2 Replies View Related

Random Generate Into A Null Field...

Apr 19, 2005

First off, I want to see if this is possible. It seeems like it should be but sometimes I dream bigger then things allow.

OK... I have a form made in Access. There is a text field that I would like to be able to do the following:

If the field is null, a number will be randomly generated betwen teh values of 1 and 1500.
If the field is not null (we entered a number between 1 and 1500), then that field would be set to that number.
The field CANNOT have the same number given (we will only have 1500 records and want them randomly generated a number unless otherwise specified).

Can this be done? I made my attempt but it keeps failing no matter how I try and fix and such. I guess this is what happend when you haven't used Visual Basic in about 4 years.

PLEASE HELP! Thanks In Advace,
Tara (aka Bay)

View 14 Replies View Related

Using Two Fields In A Form To Generate A Third Field

Oct 9, 2015

I've got a form where I want to add an employee and I have three fields (EmpFirstName), (EmpLastName), and (EmpCode).They all have their own control source from a table but what I want is EmpCode to automatically fill in after they type a first name and last name and not be editable. Smith, John and the empcode will fill in with smijo (3 of last and 2 of first). I understand this is probably completed using Expression Builder (not sure on the command) and how do I make it so Empcode still receives the data entered??

View 2 Replies View Related

Generate Value For Text Field In Report Based On Query

Jan 20, 2008

Okay I have a report (rptHorneOstbergQuestionnaire) that is based on a query (qryrptHorneOstbergQuestionnaire). In the report I have a total (HOTotal) which is the result of an expression created in the qry. Based on this result I would like to generate text in a text field (HOType) that is found in the same report.

Basically if the field HOTOtal shows any vaue between:
16 and 30 then I want the unbound text field to show the text Definitely evening typw and so on ...(see case statement below)

I thought I could do a case statement on report open but I am getting an error that my expression contains no value.

Here is the case statement

Private Sub Report_Open(Cancel As Integer)

Select Case Me.HOTotal

Case 16 To 30
Me.HOType.Value = "Definitely evening type"
Case 31 To 41
Me.HOType.Value = "Moderately evening type"
Case 42 To 58
Me.HOType.Value = "Neither type"
Case 59 To 69
Me.HOType.Value = "Moderately morning type"
Case Else
Me.HOType.Value = "Definitely morning type"

End Select

End Sub


What else can I do?

View 2 Replies View Related

General :: Auto Generate ID Where Field Is Text Format

Jul 10, 2012

I have
Table called "Products"
Field 1= "Product ID" which is a text field (PK) but numbers are used (ie 1 -20)
Field 2= Products -showing our list of 20 products

When I enter a new product, currently I have to look in the table to find the last ID used then use the next one available. I have created a form to be used for data entry to enter new products

What I am trying to do is :- 1, have the form open at data entry level but still able to scroll and see all records and 2, Have the form auto generate the next number available. For example, I have 20 products entered so when the form opens to enter a new product, the ID is automatically at number 21. I know absol nothing about coding. I have looked at other suggestions on the forum incl the DMAX +1 and having tried and not worked, I wondered if its because the field is a text field or I am trying to insert the code in the wrong place.

View 4 Replies View Related

Generate Random Password To Text Field From A Button

Jun 10, 2014

How can I generate a random string to a text field from a button. I

Say I have a form..

On the form I have:

X1 Button (BTN-Generate-Password)
X1 Text Field (TF-Generated-Password)

How can I make it so when the button is clicked a random string will appear in the text box

HTML Code:
Private Sub BTN-Generate-Password_Click()

(What Do I put here?) (Will it populate the Text Field?)

End Sub
- 9 Characters
- Upper and Lower Case
- Numeric & Alpha Numeric
- These Characters (!@#$%)

View 1 Replies View Related

Tables :: Auto Generate Hyperlink In Table Based On Field Name

Aug 29, 2014

I Have a table with 15000 entries. This table lists components we use. This table is used to generate queries/forms. I have been asked to add a hyperlink to this table to link to a drawing of the component. All the drawings are in PDF and in the same folder. I am looking for a way to automatically update the hyperlink fields all at once. The Hyperlink will be in the format of servershareddrawings12345.pdfwhere 12345 is the component name from the table.

But there are a few small problems with the component names.
1. If the component begins with a B- . The drawing name will be all the characters except when there is a second dash in the component. So if the component is B-12345-678 the drawing name will only be B-12345.
2. If The component begins with AB, The drawing will be the first 5 characters regardless of what follows, e.g. AB123.
3. Finally for all other components the full component name will be the drawing name.

Putting the naming to one side, how to go about auto generating the hyperlink. I have posted this in the table section, but maybe this should be in another section like queries or VBA.

View 2 Replies View Related

General :: Auto Generate A Number In Where Data Field Is Text

Jul 10, 2012

I have

Table called "Products"
Field 1= "Product ID" which is a text field (PK) but numbers are used (ie 1 -20)
Field 2= Products -showing our list of 20 products

When I enter a new product, currently I have to look in the table to find the last ID used then use the next one available. I have created a form to be used for data entry to enter new products

What I am trying to do is :- 1, have the form open at data entry level but still able to scroll and see all records and 2, Have the form auto generate the next number available. For example, I have 20 products entered so when the form opens to enter a new product, the ID is automatically at number 21.

I wondered if its because the field is a text field or I am trying to insert the code in the wrong place.

View 1 Replies View Related

Autofill Text Field Using Combo Box Selection To Generate Autonumber

Dec 10, 2013

Autofill text field using combo box selectionHello,

I'm trying to autofill a field on a form using MS-Access 2010 Web version sharepoint using macros without coding.

The form has an existing Combo Box field called Segment, using the row sources "REW", "WTT", "DBM".

A user begins filling out the form and eventually selects the Combo Box for Segment and selects any one of the segment no Multiple selection

There is another text field, which is actually alpha-numeric, called Job_No. I want this to autofill based on their Segment selection, using this format:

REW-YYMMDD-TTTT, or REW-131210-20001 for example, for today with the time displayed as military time and last Job No.(20001) for REW and Also for WTT (30001) as starting number.

View 1 Replies View Related

Generate A Field In Query With Hourly Incremented Data Between MIN MAX Interval

Aug 12, 2015

How can I put a field in my query, with all data hourly incremented between 01 January 2015 to 31 December 2015.

View 5 Replies View Related

How Do I Make A Custom Field In A Query?

Aug 27, 2007

I have a query in my database, and I have recently added new possible entries for area. My report tells me how many male chickens vs. how many female chickens I have. Now with the new entries for area, I want my breakdown to EXCLUDE any chickens that live in a specific area.

For instance:

Pen A has 15 males & 15 females.
Pen B has 12 Males & 13 Females.
Pen C has 50 males & 50 females.

Pen C is the recent addition...

Right now my report shows: 77 Males & 78 Females...

I WANT it to EXCLUDE Pen C, so it would report: 27 Males & 28 Females.

Can anyone tell me how best to do this? I figured I would add a custom field to the query that the criteria for is "Pen = C" and then on my report I would change the data source from: =Count([Chicken Query]![Male] --- and make it =Count([Chicken Query]![Male] - Count([Pen="C"]) --- or something like that.

Can anyone help me? And if so could you help with the proper code for the second part that I am adding new? I know the Count([Pen="C"]) isn't right, but until I know exactly how to add a custom field to the current query, with the critieria of Pen="C", I don't know how to write the -Count([NewField]) code, if that would even work.

Thanks!

View 2 Replies View Related

Hyperlink Field Custom Formatting?

Aug 12, 2014

I have created a hyperlink field with the website urls in them.

What I am trying to achieve is to create another field to automatically convert the hyperlink field into a hyperlink that displays "Website" automatically for every record. I do not want users to type in the URL and then have to fill in another field to display it as 'Website'. Having both fields is important for reporting purposes and form use.

How may I achieve this? I have tried to use calculated field like: =Website# & [WebsiteURL], but to no avail.

View 1 Replies View Related

Queries :: Criteria In Query Custom Field

Dec 16, 2014

I have made a function returning True/False values. I used this function in a query and now it return value Error as well...Is there a way to set criteria to values received in that field (0/-1/#Error). I've tried putting Like 0, Like True with or without quotation mark.Also every workaround comes into play as long as it works.

View 2 Replies View Related

Queries :: Custom Field In A Query And Null To 0

Oct 30, 2013

Database query. I need the query to count the records of a field and display a number for the records of the field. For instance, one field is [Genre] and the other is [Show]. The query needs to list the Genres along with the number of shows for each genre. I've been able to just use the query design and add the genre field and I can add the show field, use totals count which gives me the genre counts the number of shows. My problem is the null. Some genres don't have a show listed so the genre doesn't even show up in the result. If I could get the the genres that have null shows to result a 0 it would be perfect.

View 5 Replies View Related

Transfer Date W/ Custom Format To A Text Field?

Oct 17, 2007

I'm building a report that requires me to concatenate several fields plus additional words, etc. But not all of the fields are the same data type. I have the date formatted the way I want it in a date/time field in one table (dd mmmm yyyy), and I want to append that date into a text field in another table, maintaining the same format.

Now, when I do a normal append or update query, it appends as medium date format (dd-mmm-yy). If I change the field type in the original table from date/time to text, it also shows up in medium date format.

Any ideas on how to make this work, or other options for concatenating fields with different data types?

edit: I don't want to change the data type of the original field to text.

View 2 Replies View Related

Reports :: Generate Number Of Rows In Report Depending On Number In Another Field

Nov 4, 2013

I have a form where we fill in information for supply of equipment to employees.

Each item must be signed for on a printed report.

I am encountering problems trying to create enough rows in my report detail for each signature of the items supplied.

For example, on the form I will select the "equipment" - 4 hats supplied and 3 boots. On the report I want the equipment set as the group and the detail to be a number or rows which equals the number of selected items. therefore under the Hats group heading I want 4 blank rows which are made up of 3 text boxes - Print Name, Signature & Date and another group heading for boots but with 3 lines.

View 11 Replies View Related

General :: Getting Invoice Number Field To Auto Generate Next Number

Jun 2, 2014

I'm trying to get an invoice number field to auto generate the next number, keeping the format as "00000"...this is what I have, which gets the next number but drops the leading 0

Code:

Private Sub Customer_AfterUpdate()
If Len(Me.[InvoiceNumber] & vbNullString) = 0 Then
Me.[InvoiceNumber] = (DMax("[InvoiceNumber]", "[tblInvoiceNumber]") + 1)
DoCmd.RunCommand acCmdSaveRecord
End If
End Sub

invoice numbers are 04024, 04025 etc...how I keep the formatiing?

View 5 Replies View Related

Generate E-mail

Apr 26, 2005

I've searched the site and haven't really come up with an answer for this. I have a Report that I want e-mailed to two people every 10 days. If someone could give me a direction to start in, it would be appreciated.

View 1 Replies View Related

Generate Many-to-many Relationship

Apr 19, 2006

I have a single table called "Books". One column is "Book title" and one is "Author(s)".

One author may have written several books, and one book may be co-authored by several authors.

It should be ok to use the analyze function to normalize the table into 3 tables. (autors, books and booksauthors_xref)

The problem is that the Authors-column contains one or more autors separated by ;

When I use the analyze function I only get the first autor in the join table. Since authors "AA ; BB" are treated as one, not to entities I had to split the field into a "co-autor" column and manually add one and one co author.

Is it a smarter vay to do the normalization?

View 5 Replies View Related

Number Generate

May 17, 2007

hey, where can i set or how can i make the access automatic generate the the number. like i want it start from:

Account number: Ra-b200
Account number: Ra-b201
Account number: Ra-b202

cheers

View 1 Replies View Related

How To Generate A Report In Vba ?

May 2, 2005

I want generate and load the report using vba when a command button is clicked . (automating the report generation)
For example i have table in access that has name, address and email fields and onced command button is clicked the report is
generated and loaded.I be happy if some one show me wprking example.Thanks

View 2 Replies View Related

Generate A Report Via VBA?

Jun 14, 2006

Hi,

I have the following very general question, but I hope you can give me a few hints so I can start and find things out on my way.

I just created a database which via VBA procedures runs all kinds of queries and puts the results in tables, for instance I have about 20 tables now with 10 fields each and for every table I want to run the same type of report.
I already made one report for one table via the report wizard, I would like to use the layout of this table for all other tables using a VBA code, so when I run this code it will create all these reports for me.
What is the best way to start?

Many thanks!

View 1 Replies View Related

About Auto-Generate A Number

Feb 2, 2005

can I make a field that can auto-number which the format that I want??

As I know that there is two format for auto-number
but I don't like them

I want to number my own format

like
XXX-YYYYMM-ZZZZ

XXX is the category number that would be selected in the form connecting to table
YYYYMM is the date year and month
ZZZZ is another auto numbering

Can I do so

View 1 Replies View Related

Generate A String From Another Number

Sep 13, 2006

i have a table where one column has numbers such as 6104003 and i would like another column to recogzie this number and make a new string in this format 61P04-003 ajacent to it. can i do that in a table or does it have to be a querie? and the bigger question is how do i do this :confused:

View 3 Replies View Related

How To Generate Employee Code

Oct 12, 2006

I have to generate unique code for each person in an Employee table. This code will not be the primary key for this table. Primary key is an auto number. This Unique code is for refering to each person in all the correspondence/document/everywhere and every person will know his code and refer in all the correspondance.

I want to make a column in this table for this code. There can be two criteria for this code generation--

1. The code will be First alphabet of first name followed by sr no for that letter in 4 digits. Say Mr. Andrew is 99th person with alphbet A then his code will be A0099. Or Miss Jany is first person with letter J, her code will be J0001.

OR

2. The code will be a five digit 7 digit number--of which the first 4 digits are year of joining in organisation and remaining 3 digits are joining serial number of this person in that year.Say Mr. Andrew is 12th person who joined in 1996 then his code will be 1996012. Or Miss Jany is 118th person who joined in 2000, her code will be 2000118. For this I will add two columns namely Joining Year and SrNo in this Table.

I want the Access, by some means to generate this code based on the above critaria in one table.Can you people help me with the ideas about achieving this task. Presently we are manually assigning these codes.

View 14 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved