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.
The following is code to open a form and records with a specific date as input by the user:
Private Sub cmdDisplayCovers_Click() On Error GoTo Err_cmdDisplayCovers_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "frmInventory" stLinkCriteria = "[tblCovers].[Date] = [Forms]![frmCoversByDate]![txtDate]" DoCmd.OpenForm stDocName, , , stLinkCriteria etc. etc.
generate a message to user if no records match the input and then return to the input form. Currently, the form opens even with no records.
I have a database studentreview. with the name of the student, the location of the student the course and the status of the course. What I am trying to do is when a condition is meet the name of the course "Anatomy" is meet and the status "Done" is meet I want to auto-generate a new record with the same student name with the same town and the course will be "anatomy 2" and status "not done". The name of the student and the location are linked tables with the studentreview table. This is what is did with a record set but clearly I am doing something wrong since nothing is happening
Public Sub AddRecordset() Dim db As Database Dim rs As Recordset Set db = CurrentDb Set rs = db.OpenRecordset("tblStudentreview")
I am using a API to generate a random / unique directory. This an API form a 32-bits environment.
I know that you can still use it when declaring it with PtrSafe
This is the code I am using:
Option Compare Database Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long Private Declare Function GetTempFileName Lib "kernel32" Alias "GetTempFileNameA" (ByVal lpszPath As String, ByVal lpPrefixString As String, ByVal wUnique As Long, ByVal lpTempFileName As String) As Long
Is it possible to generate a report from 2 listboxes?
I have attached a pic of what I am trying to accomplish. I am wanting to have a report open with only the criteria that a user selects from the listboxes.
listbox 1: User selects a case number(s)
listbox 2: User selects the fields they would like in the report
So, if the user selects:
Case number: 13-001
Then selects fields:
Allegation Incident date Focus_Last name
This report would be:
Code: Case Number Allegation Incident Date Focus_Last Name 13-001 DUI 06/01/2013 Doe
I have a table with a field that contains IDs, e.g.
123 456 789
I would like to generate a single string from this table, seperated by commas, e.g. 123, 456, 789 and output to a field in an existing table. This will then be used in a SQL statement.I am new to VBA and don't reallly know where to start/
How to generate an export specification file by using Access 2007. Many instructions says click on "Advance" while exporting a text file manually but unfortunately i can not find that "Advanced" option in my access software.
i have these code to auto generate member number but the highlighted line generate error 94 - invalid use of NULL:
Private Sub cmdGetNumb_Click() 'On click of button a new Member Number is generated and 'focus is moved to tFName field. Me![nMembNum] = NewMembNum() Me![tFName].SetFocus 'Prevent accidental click Me![cmdGetNumb].Enabled = False
I am trying to concatinate string in a loop to generate a dynamic SQL to compare 2 tables. But I am not getting the result I want
Code: Set rs = CurrentDb.OpenRecordset("r1") Set rs2 = CurrentDb.OpenRecordset("r1_old") columnCount = CurrentDb.TableDefs("r1").Fields.count strSQL = "" For I = 0 To columnCount
[Code] .....
I am trying to achieve something that reads like the following
r1.Field(0) = r2.Field(0) AND r1.Field(1) = r2.Field(1) AND r1.Field(2) = r2.Field(2) AND .....
I am trying to make an automation in order generate reports based on query ( person name,person email address ) , export them to a folder in PDF and then send them one by one to each person email address.
What is happening:
- the reports are generated and exported fine - the email are sent to the right addresses but the first person receives the correct report , the second person receives the report from the first person plus its own report and so on.
Here is my code :
Private Sub MakeReportSendEmail_Click() Dim MyDB As DAO.Database Dim MyRS As DAO.Recordset Dim strSQL As String Dim strRptName As String
I'm using VBA code to open a query, generate a report for a test and an answersheet. I'm using the same report, and don't want to make many reports. I have the below code which runs my query, and generates the reports.
Private Sub Command2_Click() DoCmd.SetWarnings False DoCmd.OpenQuery "1", acViewNormal, acEdit DoCmd.OpenReport "WrittenExam", acViewPreview, "", "", acNormal DoCmd.OpenReport "WrittenExamAnswerSheet", acViewPreview, "", "", acNormal End Sub
I have a need to be able to set the report title for both reports when running my code.
So Access was unable to manage the amount of content that I needed to produce in a single report. The reports contain 12 charts/graphs all of which I needed on separate pages (one chart per page). As such I could not create large enough charts in access to fit to each page, as Access limits the amount of space one can use in a report.
I downloaded Microsoft Reports Builder 3.0 and built my reports as needed and can generate them as desired at current. I'm wondering if there a way to call that RDL file I created to generate my reports from a form control button in Access?
I am building a simplified re-order point system - if inventory position drops below a certain level (the yellow level is this case) one or more purchase order lines has to be created in another table.
I have one table with the following field and data:
ItemId Red Yellow Green Multiple Inventory position 0001 10 30 50 5 45 0002 5 40 47 5 23 0003 11 20 30 10 5
I would like to generate new records (in another table) based on the above fields and three records.Basically the end result should look as the following:
The logic is quite simple - if inventory position is less than the yellow value new order lines should be created in multiple qty (based on the multiple field) until the aggregated value (in table 2) is above the green value.The priotization value should be based on the start inv (in tbl 2) compared to the values in red, yellow and green in tbl 1.
I have made a query with the name "Confirmation" and it is setup like this:
Name trainee Email Training John John@mail.com Tr one Mary Mary@mail.com Tr two
I also made a button in a report with the title "Send Mail" now is my goal that if i press that button automatically multiple e-mail message's will be generated with data from people in that query. So if click on that "Send Email" button i want two different mails messages generated that will be send to John@mail.com and Mary@mail.com with in the mail body their data.
Friends, I need to place a vba code from a regular event in a form to a module so that when the form opens the function in the module is recalled using a macro. How do I do this?
For example, I have the following code in the OnOpen event of a form:
Dim strInputBox As String, bytChoice As Byte InputPoint: strInputBox = InputBox("Please input the password.", "Password Required - Restricted Area! ") If Len(strInputBox) > 0 Then If strInputBox <> "***" Then bytChoice = MsgBox("Wrong password" & vbNewLine & vbNewLine & "Do you want to try another?", vbExclamation + vbYesNo, "Warning") If bytChoice = vbYes Then GoTo InputPoint End If Else DoCmd.OpenForm "Maintenance" End If End If
I would now like to place this code in a module and run it using a macro.
I have a form (frmCommoditySupplierSpend)and a subform (frmCommoditySupplierSpendSubForm1ByVend). I have a control button in the main form that will scroll down the page of the main form to a point I desire by using:
The problem that I am having is in my subform I have a button as well and when a user clicks the button in the subform I want the main form to scroll down to the same point. I thought the same exact code should work, but it ends up scrolling down the subform instead of the mainform, even though the main form is being stated. how to scroll down my main form when using a contol in subform.
I have a form based on a query and have written code to display a msgbox if a duplicate entry is inputted in the NHS_Number field in the form. I have also added code "me.undo" to clear the form so that it is not saved. I am looking for a piece of code that will display the duplicate record. Here is my code thus far:
Private Sub NHs_Number_BeforeUpdate(Cancel As Integer) Dim dbs As Database Dim rst As DAO.Recordset Dim x As Integer
I have recently upgraded to Access 2013 and this has updated all my object library references to 15.0. The problem is that my colleages are still using Access 2010 and when they try to use the database they are receiving a missing reference error.
I have removed the Excel reference but this gives me the 'object type not recognized' error when running the code.I have tried to download the 14.0 reference libraries in order to add them back in but for some reason the installer doesn't work.
I am trying to use a textbox value to call vba code and can not get it to work.
I keep getting an error on the call str1 line.
Code:
Sub formscript() Dim str1 As String str1 = [Forms]![fscripts2]![t3] 'MsgBox str1 If str1 = "" Then str1 = "err1" Exit Sub Else Call str1 ' this is where it call the script based on value in textbox End If End Sub
I am having a few issues with my module code in Access 2002. for some reason every time I write some code Access is automatically making the first letter a capital so for instance [Our Ref] should be [Our ref] but it simply will not let me do it!