I've got most of what he wants sorted but this last task I am completely flummoxed. All of his projects are allocated an ID (named Project Reference), starting from P010010 and increasing by 1 each time. I've made a form that allows a new project to be recorded by entering all the details and hitting the 'record' button, but he wants the Project Reference field to be automatically filled in each time (understandably), increasing by 1 from the last record.
So if the last record was P010311, then when the form opens the Project Reference should automatically be P010312.
I've looked into this and found many guides talking about DMax and DIM and strCriteria and whatnot, but no matter how many of them I follow and try to adapt to my own database I can't get it to work at all.
The table the ID comes from is called General, and the field is Project Reference. The ID should automatically be filled into a text box called txtRef whenever the form opens and a button to add a new record is pressed, being 1 higher than the previous ID.
Currently I'm working on an invoicing database in which I can register my customers (or partners) and also make invoices and purchase orders. So far, it does exactly what I want it to do, but I'm struggling with the invoice numbers. What I want to have is that whenever I make a new record, the next invoice number in sequence is automatically assigned to it. Another desire is that this number is prefixed with the current year, and the counter should reset with every new year. So, for example:
2015001 2015002 2015003 etc.
Then
2016001 2016002 etc.
Don't worry about the maximum of 999 invoices, because I won't ever go beyond that limit.
I would like to enter a couple of alphanumeric groups into a field on an input form. After I enter an alphanumeric group, I hit the enter and the data will add into the field and refresh to empty box ready for next entry. If I continue to enter another group and hit enter, the next group will be added to original field with a comma and a space in between. build the VBA in after update event to accomplish the task.
I have a form that when I insert a registration number I would like the value of the field "nom" the name automatically appears in the "nom" field of the form. The form uses a query.
I am putting together a simple database to do with monitoring maintenace of buildings. I was the building number to automatcially populate when the building name is select.
I have got the the point where I have building name and number in the building name combo box but i'm stuck with the after update code builer part.
how to automatically populate a certain field. To add some context, I have a form which registers the details of a contact with standard information of contact details. There is a subform which shows the different products that the client from the main form is interested in. This is a actually a data sheet which returns the results of a query (selecting from the relevant table the client in question and the products he/she wants).
I have added a button which opens up another form and allows a product (and hence a new record) to be added for that particular client. I would like that the form automatically populates one of the fields in the form that is the client id. Given that the subform is opened from a form which already identifies the client, how do I do this?
I have a text field in a table that contains an alphanumeric code. i.e.
DEL998 DEL999 DEL1000 DEL1001 SUN998 SUN999 SUN1000 SUN1001 SUN1002 etc.
I want to run a query to find the highest number for a particular alpha code. In the example for DEL I would want the query to return DEL1001.
I have created a select query that asks for the alpha code, selects all codes starting with that code, sorts them in decending order and only displays the first record.
The problem is that because the field is a text field the numeric is not sorted like a number. So in the DEL case the query returns DEL999.
I have a database I have worked on for the sister company of the place I am employed.I have a field I am trying to make alphanumeric that has been numeric. (PO Number on the main form). I had make it alphanumeric a couple of months ago, but it disabled the Edit Customer Information button on the bottom right of the form to where I cant enter shipping addresses and things like that. It should be able to enter multiple shipping addresses.
I need making the PO Number field button alphanumeric and making sure it doesnt mess-up the Edit Customer Information button. I have attached both versions of my database. The GM at the sister company would also like me to create a Spin button where you can take an old record and keep all of the previous information on it, except it gives it a new Work Order# and you can change the date to something newer.
I am wondering if Access 2010 has the capability of automatically filling in a field from info keyed into previous fields. For example, I want a confirmation number issued which is made up of all the characters keyed in the previous three fields. For example, assume the previous three fields are:
Block = 01 Building = 125 Room = A Confirmation Number =
Therefore, the confirmation number would automatically be filled in as 01125A.
I have searched this forum but didn't find the answer, I hope I'm not the only one with this problem. I have two text fields in a table that are updated through an excel file import. In the excel file, both fields contain data that is mostly numeric, but there are always about a quarter that contain letters as well. When I go to import the excel file, it sets to null any value in the fields that contains letters. If I sort the excel file in descending order for the field, it will import, but I have two fields that do this, so this brings more problems. Does anyone know why you can't just import anything in any order into a text field?
hi i found this code here and it works IF the number comes first and is preceded by a letter 123AA
but it does not work if the letters come first AA123
here's the code
Public Function GetString(WholeString As String) As String Dim i As Integer Dim Temp As String Temp = CStr(WholeString) For i = 1 To Len(WholeString) If InStr(1, "0123456789.", Mid(Temp, i, 1)) = 0 Then GetString = Mid(Temp, i) Exit Function End If Next i GetString = Temp End Function
Public Function GetNumber(WholeString As String) As Double Dim Temp As String Dim i As Integer Temp = CStr(WholeString) For i = 1 To Len(Temp) If InStr(1, "0123456789.", Mid(Temp, i, 1)) = 0 Then GetNumber = Mid(Temp, 1, i - 1) Exit Function End If Next i GetNumber = Temp End Function
the probelm is with this line but i'm not sure what it is
GetNumber = Mid(Temp, 1, i - 1)
(i also get runtime error 13) but my data is in the same format as the example i downloaded.
any ideas anyone?
thanks in advance and thanks to the person who created the code
I have an existing form where users type in information and it generates a couple of reports. In one of the fields, Customer PO Number, the user enters a number from a customer. Up until yesterday all of the customers we have been dealing with have used numbers only for their PO numbers. However, we have a new customer that requires alphanumeric PO's. Is there a simple way to change this field from a number to alphanumeric without having to redo each form, report and/or query. I am using MS Access 2010.
i have 2 field "CLIENT ID" and "CLIENT CODE". when i post a new record, i want the "CLIENT ID" and "CLIENT CODE" to merge to give me 1 field "CLIENT". the CLIENT CODE should be prompted for eg. THO or BLT and added to the CLIENT ID which will compose of 001 or 002. The CLIENT ID should also increment when each new CLIENT record is posted.
I have a numeric field called FileNo and an autonumber field called FileID in a table called tblFile. I also have a lookup numeric field called FileTypeID (with values 1 or 2 or 3) on another table called tblFileType.
I need the value of FileNo which I am showing on a Form frmFile to change dependant on the value of the FileTypeID i.e. If FileTypeID = 1 FlieNo should start at 100 If FileTypeID = 2 FileNo should start at 200 If FileTypeID = 3 FileNo should start at 300 Then when I create a new record I need to increment by 1 the value of FileNo according to the FileTypeID
I've setup a button and attached this code to its onclick event but it only works as long as I don't change the FileTypeID
Dim B As Integer Dim H As Integer Dim N As Integer
Do While FileID > 0 DoCmd.GoToRecord,,acPrevious If FileTypeID = 1 Then B = FileNo Else If FileTypeID = 2 Then H = FileNo Else If FileTypeID = 3 Then N = FileNo End If End If End If Loop
DoCmd.GoToRecord,,acLast If FileType = 1 Then FileNumber = B + 1 Else If FileType = 2 Then FileNumber = H + 1 Else If FileType = 3 Then FileNumber = N + 1 End If End If End If
SELECT units, nation, unique_brigades, Switch ( [unique_brigades]='A', 2000, [unique_brigades]='B',3000, [unique_brigades]='C',4000) AS brigade_number, unit_urn_desc AS urn_desc FROM units
What I'd like to be able to do is increment the values (2000,3000,4000) by 1 for each new row. Does anyone know a way to do this?
I have a table called tblProducts. Within the table I have a field called versionNumber. I want to update the version number to increment by one each time I run a query.
So if the version number is 1 after running the query it becomes 2. So far I have done the following:
CurrentDb.Execute "UPDATE tblProducts SET tblProducts.versionNumber = "Need to increment by one, don't know how to" FROM tblProducts;"
Please advice me how to implenent the Update query.
Basically, we have different camera modules on which we perform a given test a number of times, giving rise to 2 tables, tblCamera which will store basic info about the module and tblTest which will hold info for each test perfomed.
The camera module has a unique ID (CameraID, the Primary key in tblCamera and foreign key in tblTest (one to many)). The primary key in tblTest will be a compound key of CameraID and an incremental number for each test performed on a given camera (TestNo). The data for the tests will need to be entered through a form, so I can build a form based on tblCamera with a subform based on tblTest (which would be in datasheet view)... What I am looking for is a way to increment TestNo in the subform, starting at 1. I have tried using
in the Default Value box for this field, which works to a point but has the curious effect of adding each number twice (as the default value for a new record seems to be added as soon as you start typing in the current 'last row')
I just can't seem to get my head around this one, any suggestions would be much appreciated...
I have a field in a form that contained 8 characters long (Ex: ZWXX0001). The first 4 character always stay Constance. However the last 4 characters I'd like it to increment by 1 after each time user press enter to go to the next record when they do data entry. If this possible will save my user a lot of time. For Example: ZWXX0002, ZWXX0003, ZWXX0004 . Is this possible? Thanks in advance..
I have a form that is being used for sample submission. Ideally, the user will be able to put in some information (3 or 4 fields) and the number of samples that they're taking, click the arrow and it will insert that number of samples into a temporary table that is then displayed on a continuous form. From there, they can edit samples, add more samples, and generate a report to submit to the genotyping group. Once their sample list is final, I will append it to the master list and clear the temporary table.
I've got the basics working. A looped "INSERT INTO" using a counter inserts the relevant information. I cannot, however, seem to get the numbering field to work.
Ultimately, the numbers need to look something like MySample-001, where MySample would be one of the other fields. Incrementing the 001 is the problem. In another situation in the database, I can successfully use DMax+1 to assign a single number on a single form, but I can't get it to increment the sample numbers.
Ideally, I'd like it to happen when the form is generated. However, I'm also open to having them assigned when the sample list is finalized, before inserting into master table.
I have inherited an Access DB that is supposed to be kept "alive" but not made much better. On a weekly basis I get an Excel CSV that I'm supposed to import into one massive table; that works just fine.
However, there is another query that takes values from a table named "New Users From Import Table" and appends them to the current "User" table.
But before running that query I have to manually update a field called "Display Name ID" with the next highest number from the User table but only the highest value that isn't in the 9000 number range.
For example, my next highest "Display Name ID" is 1144, which of course does not include the records that range between 9000 - 9008.
I had to manually enter 89 "Display Name ID" values yesterday and I know there has to be a way to update that field when I pull the data over from the temp table without having to do it all manually.
Here's the query that pulls the data into the "User" table (after I've manually entered the incremented values).
INSERT INTO Users ( [Display Name ID], [User Type], Organization, [Display Name], [Alias Name] ) SELECT [New Users From Import Table].[Display Name ID], [New Users From Import Table].[User Type], [New Users From Import Table].Organization, [New Users From Import Table].[Display Name], [New Users From Import Table].[Alias Name] FROM [New Users From Import Table];