Assign A Unique Two Letter Code To A Set Of Record?
May 23, 2012I am trying to assign a unique two letter code to a set of record. From AA..AB..BA....all the way to ...ZZ, how do i go about doing this ?
View RepliesI am trying to assign a unique two letter code to a set of record. From AA..AB..BA....all the way to ...ZZ, how do i go about doing this ?
View Replieshave two table - TABLE 1 contains letter of the alphabet and a user assigned to each letter while TABLE 2 contains company name and user assigned to each company.What I'm hoping is if I change the user2 for letter A in table 1 all the company that starts with letter A in table 2 will have the user2 as the user assigned.
View 4 Replies View RelatedI have a table (tblPrinterSelection) with three fields: Autonumber, DocType, PrinterSel
There are three types of values for "DocType"; "Document", "LargeLabel", "SmallLabel"
I want to assign a "PrinterSel" to each type of "Doctype", which basically means that the user selects the type of document and then the printer in a form that has the code below and then I need the code to automatically update the table.
Code:
Dim PrintSel As String
Dim DocType As String
'Assign a value to the printer selected variable
PrintSel = Me.lblPrinterSelected.Caption
If IsNull(Me.frmDocType) Then
MsgBox "No document type selected."
[code]....
What i am looking for is code that would pick the value for "DocType" and "PrintSel" assigned here and add them to the table so that I can use that info later.
I am only looking to have three rows in that table so if the "DocType" does not exist then a new row is created but if it does, only the value of "PrintSel" is updated.
I should end up with something like this:
1 Document Epson
2 LargeLabel HP
3 SmallLabel Canon
How can I do this?
Visual Studio IDE environment and I have been working with Access VBA for almost a year now.
I am very used to generating my form controls in runtime and being able to create some cool user interface interactions by being able to say btnExample.OnClick += MyDynamicClickFunction
MyDynamicClickFunction(Object sender, EventArgs e).... code
Any way to assign functions to the events of already made controls on a form. Probably during the load event?
Now I have found that there are many ways to replicate Visual Studio's features by accessing User32 and replicating them
I have form call frmmasksetup which holds records of the types of masks I have and this contains serial numbers from the masks ETC...
I have another form called frmemployee that hold all my employee's detail's name,last ETC now my problem on the frmmasksetup page I have combo box to select employee but can't get it to Assign the mask to the employee and on my employee form I have subform to display which mask is assigned to which employee.
Hi,
I'm designing a database in which the primary key is a combination of the first letter of first name, the first letter of last name and the date of birth.
How can I do that?
Regards,
CS
I'm looking for a simple routine, preferably in the On Key Down or or On Key Press event of a form to quickly navigate to a record based on the key pressed.
I have a form with names in a table layout (continuous form).If the user is on the name field, I'd like it to navigate to the first record that contains first letter of the key pressed. So if a user presses "K", the form will go to the first record that starts with a K.Yes, the names in the form are alphabetical, but in a list with over 100 names, this could speed things up just a bit and save a lot of scrolling and looking.I was thinking of using KeyCode and I already have an event to navigate by the arrow keys so I'm considering building on that.
Code:
If KeyCode = 40 Then ' Down arrow
DoCmd.GoToRecord acForm, Me.Name, acNext
ElseIf KeyCode = 38 Then ' Up arrow
DoCmd.GoToRecord acForm, Me.Name, acPrevious
End If
I am thinking to use a Select Case and add the key codes for all the letters.
I was wondering if anyone could help me with a problem I'm having with a form...
I have 2 tables, one called 'dept' and the other called 'employee.' These tables have a one-to-many relationship; basically, one department to many employees.
Instead of using a combo box, how do I assign an employee (employee_table) to a department (dept_table) by simply selecting a checkbox on a tabular (employee) form and the record is automatically added to the dept table?
I would greatly appreciate any help. Thank you!!!
Me!ComboName.DefaultValue = Me!ComboName.ItemData(0)
this assigns the first value in the combo box to the default.
can this be changed to always assign the last possible record in the list as the default.
I have a Project Database where I keep track of projects throughout my plant. A project can have one owner or several owners working on it. Is there a way to assign multiple owners to a project?
I tried doing a subform but I don't like how it looks on the form and when I try to do a query that filters based on a person's name, the form has to be a single form rather than a continuous form which is not what I want.
Is there another way that I can accomplish this?
ok here is what i want.. imagine a search box, just an empty text box that allows the user to type things into it...
there will be a simple table from the database behind it, here is the typical structure of a record
<Country>Poland
<Price1>60
<Price2>85
<Price3>95
in this table there will be say a 1000 of these records...
my user is going to have to quickly search through these records while on the phone to a customer, and quote one of the relevant prices associated with that country
what i would like is this most convenient system..
as the user types in the letter 'P' just below all the records with countries that begin with 'P' are displayed (with a scroll down arrow if needed)..as well as the 3 relevant prices with that record
if they then type an 'O' into the box (which will now hold 'Po') all the records with countries beginin with 'Po' will be displayed (eg Poland)
if they delete the 'o'. once again the displayed records below the box will return to just the countries begginin with 'p'
all that is needed is for the records to be displayed, thats it.. but the adding and deleting of the letters within the text search box will need to instantly manipulate this list..
i have posted on other forums, and have been told this can be acheived in access, is it hard?
Is it possible to assign a query to the recordsource of a form dynamically? I assume the answer is yes. Can this action be done when the form is not open? If yes what is the correct syntax to use when the code is in a normal module as a public sub? I tried many possibilities and could not get it to work.
Code:
Dim ForNm as string
Dim Qry as string
ForNm = "PersonalFm"
Forms(ForNm).Recordsource = Qry
Forms![PersonalFm].Recordsource = Qry
[Forms]![PersonalFm].Form.Recordsource = Qry
I have a query which displays two fields: client ID and order type. I want to be able to display the client only once per order type. I tried to use GROUP BY order type but that gives me a missing expression message. I also thought of using UNIQUE as YES in qry properties but I'm not sure as to which row that property applies (all of them?). What is the best way to display a unique client in one row and order type in the other? So for example for order type "CASH" I wil then have a list of unique individualIDs.
thanks,
M
I want to select unique country names from a recordset and now my code is
strSELECT = "select distinct country"
The problem is that ASIA and Asia are different, but it only selects one.How can I include both of them?
Hi,
I'm not sure where to post this, maybe VBA or Forms would be better, but I think it's fundamentally an index problem, so I'm posting here. I've searched both the net and here, but most of the questions are about preventing duplicate records.
I want to prevent duplicate records but save changes to existing records.
I have a form based on a table that has a 3-field-unique-index (but not the primary index, which is autonumber). I've written a function to check for existing records with the given combination of the three fields, as long as all have data (it bails if any are null). I'm calling the function from BeforeUpdate for each of the textbox controls. I was also calling it from the form's BeforeUpdate, but commented it out as it seemed redundant. I have other code there verifying that the user wants to keep the changes.
I'm trying to save the users from getting all the way to the end before discovering there's a problem. To test it, I added then deleted one character from one of the three relevant fields in an existing record, and bing, up pops my alert that I'm violating the index. Then I can't leave the field, I'm stuck there because I can't save the record.
I want it set up so that other fields in the record can be changed/updated AND so that a new record for the same person can't be entered (a dupe).
Oh, and I'm running into all kinds of problems with acCmdSaveRecord not being available. I feel like an idiot that I haven't been able to make sense of the posts about that. I can just comment it out and let Access save the record when it closes the form. But my bosses really want the users prompted about saving changes.
Any thoughts or suggestions or insights greatly appreciated. I really tried to search this out, so any tips for better searching are also appreciated.
Here's the code for the function:
Public Function CheckForClientDupes()
Dim response As Variant
Dim strFamID, strLName, strFName As String
Dim strFilter As String
If IsNull(Me!FamilyIDNo) Or IsNull(Me!strLastName) Or IsNull(Me!strFirstName) Then
Exit Function
End If
strFilter = "[strFamilyIDNo] = """ & Me!FamilyIDNo & """ And " & "[strLastName] = """ & Me!strLastName & """ And " & "[strFirstName] = """ & Me!strFirstName & """"
If DCount("*", "tblClients", strFilter) > 0 Then
response = MsgBox("There is already a client with this combination of FamilyID, Last and First names in this database. Would you like to Continue Anyway (Yes) or cancel data entry and Erase Your Changes (No)?", vbYesNo, "Duplicate Client Alert")
If response = vbYes Then
' DoCmd.RunCommand acCmdSaveRecord
Else
response = MsgBox("You have chosen to cancel your changes. Your changes will be erased.", vbOKCancel + vbQuestion, "Data Entry Cancelled")
If response = vbOK Then
Me.Undo
Else
Exit Function
End If
End If
End If
' Me.FamilyIDNo.SetFocus
End Function
Is it possible to create a combo box to list all record ID, when selected that record appears on the form?Ifso how would i go about this?
Thanks in advance?
Andrew
This is probably dead simple, but I am brain dead today.
I have two tables:
Requests with fields (ID, Cust, Amount, Ref, Date)
and
Actuals with fiels (ID, Cust, Amount, Ref, Date)
Now,
if Requests.Ref is null, then update Requests.Ref = Actuals.Ref and Requests.Date = Actuals.Date if and only if
there is only one record in Requests and only one record in Actuals where Requests.Cust = Actuals.Cust and Requests.Amount = Actuals.Amount.
Currently, I am just doing an inner join between the two tables, but if there are two requests with a given cust/Amount, but only one Actual, then both Requests will get the same Actual Ref and Date.
So how do I structure this SQL?
Thanks,
David
I have a table like so:
Code:
PatientID VisitDate Complaint TestPos
1 4/5/2003 Coughing 1
1 1/2/2007 Sneezing
1 5/1/2008 Unknown 1
2 2/1/1988 Unknown
2 4/2/1988 Unknown 1
I'd like to extract just one TestPos record (TestPos = 1) per Patient ID. And I always want to select the record with the earliest date. So the result would be:
Code:
PatientID VisitDate Complaint TestPos
1 4/5/2003 Coughing 1
2 4/2/1988 Unknown 1
I can do this but it requires 3 queries: a SELECT query where TestPos = 1, a GROUP BY PatientID query and MIN(VisitDate) to get the desired record per patient, and then another query that links the two so I can get the additional variables (e.g., Complaint).
Is there a way to do this without using 3 queries? Seems inefficient.
Hi I have a very simple table, with say 5 fields (all text). There is only 1 table. The first field is name, and I want to enforce its uniqness across all other table.name values. I am completely new to Access database and am not sure how to do this.
Any help would be greatly appreciated.
Thanks, Edin
I am using a software drawing program that intelligently link information from a drawing to a database and vice versa. I have many tables and queries that I have created over time that enable auto populating of tables, creation of tables and so on. All of which enable me with tabular documents for ordering purposes.
The problem I currently have is: - I want to create a table that looks at an existing table, analysis various fields for duplicate information and then adds one record to a new table. This is to enable me to create a spares list based on the entire list.
I have a full valve list with various items, some duplicates some not. I am required to produce a spares list that considers only one of each type.
Example 1:
2011-1
.......
2011-3893 etc.
Currently I have an Access form which produces a new unique number to identify each new record created. To do this I use the unique ID autonumber from a table to identify the new records. I would like to change from this simple number to the the above format per example 1. The four digits to the left of the hyphen would always be the current year and digits to the right of the hyphen would be the unique auto incrementing numbers such as from my table. I need the year to auto increment by 1 each September 30th (new business year) and I need the numbers to the right to auto reset to 1 to start uniquely identifying records again for the new incremented year. As each record is closed I need the number to be written as a single entity in the new format to my database.
Example 2: After September 30th.
2012-1
.......
2012-447 etc.
I have a database in Excel that contains farmers who can be identified by a Unique identifier: MZ-01-0001. The registration details for these farmers are not always up to date. Now when I try to append the data for the farmer with MZ-01-0001; with the primary key set on the Unique identifier, Access does not want to do it since there is already a record in the system. When I remove the primary key it doubles the record, which is also not what I want. So I am wondering what I need to do to append the record while keeping the primary key intact.
View 4 Replies View RelatedI have a MS Access 2000 database with 136 data tables in it. What I would like to do is execute a piece of VBA code which will list for me in another table, (for example: Field1: TABLE NAME Field2: FIELD NAME 1 Field2: FIELD NAME2 etc), starting left to right, how many fields would have to be combined in each table to represent a unique record.
For instance:
TYPE ID TEXT
1 1 "Cats"
1 2 "Dogs"
2 1 "Rabbits"
In this example a combination of the fields TYPE and ID give a unique record.
Any help most appreciated.
Dalien51
I have a table with data like this
Field_1,Field_2,Field_3
A,B,5
A,B,3
A,C,7
A,C,6
X,Y,4
X,Y,3
I need a report where I can only see
A,B,5
A,C,7
X,Y,4
That is Group by Field_1 and only show the records which has Field_2 with the max. value of Field_3
As mentioned before on a different topic I am building a database to sort through publication authors. I currently have the table sorted in a way that only the main author is listed for the 3000 records. Now I need a way to remove duplicate entries on a new table. Each entry is a different publication. Each record has a DOI code that is unique and an author which might be a duplicate. I want a new table listed by author once and a new field that list all of the DOI numbers for that author.
I know how to do a query to show only the unique names, but how to I also get the database to combine the records that share the same author.?
I am building a database to capture monthly statistics on a number of items. I want to ensure that users don't enter statistics for the same item for the same reporting period. I found the following instruction, but can't make it work:
It suggests that I create multiple primary keys in the table
When I do it, it comes back with an error: Index or primary key cannot contain a null value.