Modules & VBA :: Capturing ID Number Of Record For Future Use

Mar 12, 2014

I trying trying capture the ID no. of a record for future use. I have tried different combinations on different form events. Nothing works, what am I doing wrong? The latest I have tried is the following, on the load event,

Code:
Private Sub Form_Load()
Dim LoadNo As String
DoCmd.GoToControl "ID"
LoadNo = Me.ID
txtLoadNo = LoadNo
End Sub

View Replies


ADVERTISEMENT

Queries :: Show Data Older Than Specified Number Of Years From Future Date

Apr 22, 2014

Querying a field for a number of days from today's date but not had a lot of luck finding how to query this from a date in the future.

Currently I have as criteria for the relevant field:

Code:
<[Period Start (dd/mm/yy - less 5 years from financial year end)]

which prompts for a parameter but using this I have to figure out the date 5 years from the future date first and then enter this.

Surely there must be code that allows me to simply enter the date, in the prompt and this then shows me data of 5 years or older equipment!?

View 8 Replies View Related

Modules & VBA :: Capturing Form Data In Email

Jan 30, 2014

So, I'm very new to Access and not all that skilled in VBA. I have, through trolling the internet found some code that does allow me to send an email on the click of a button on a form through Lotus Notes.

However, I cannot get any of the data on the form to show up in the email.

How do I even do something simple like, have the subject line come from a text box on the form or have the body come from a text box (or 2)?

Here is the code I have so far - also, the "attachment" part does not work - but one problem at a time...

----
Public Sub Command15_Click()
'-------------------------------------------------------------------------------
' Date: 02-06-2003
'
' Sends an email via Lotus Notes.
'-------------------------------------------------------------------------------
'Set up the objects required for Automation into lotus notes
Dim Maildb As Object 'The mail database
Dim UserName As String 'The current users notes name
Dim MailDbName As String 'THe current users notes mail database name
Dim MailDoc As Object 'The mail document itself

[Code] ....

Again, I literally just have this as an event on "On Click" for the button. Nothing too fancy. It sends an email....with whatever text I manually put in to this code....which is not ideal....

View 9 Replies View Related

General :: Capturing And Saving User Name Who Created And Updated A Record

Jul 20, 2012

I have taken the Access Tasks template and modified a bit. It now captures and saves the time and date a record is modified. The database is on a network folder and is shared among our team users.What I would like to do next is make it,

1- capture and record on my Tasks table the user name of who created the record by using the fOSUserName() function. I have the table fields "Created by" and the VB code in a module. This would happen only once when the record is created.

I would also like to do this with the machine name for which I have the module too. fOSMachineName()

and,

2- capture and record the user name of who modified a record. For this I also have a field in my task table "Last Modified By" and i hope i can use the same fOSUerNmae() function.

I got to the point where I put an unbounded text box with the =fOSUserName() in it and it does show the user name but how do i get to record to my task table?how the template removes the tasks that are completed from the task list as soon as it is updated to completed? how can I make this happen with a cancelled option after I add it to the drop down list?

View 3 Replies View Related

Modules & VBA :: Capturing And Change KeyCode For Input To Text Box

Sep 24, 2013

To facilitate input of special graphic characters such as the degree C and plus-and-minus symbols, I would like to use Alt-1 to Alt-9 key combinations, capture these keys in a KeyDown event procedure and change the keystroke to the desired graphical character code. I am using Access 2010 on Win7.

I first attempted to change the Shift integer to zero to reset the Alt-bit and set KeyCode to the desired character code, but this does not work. Hence I try to use the second common method of setting KeyCode to zero and use SendKeys to VBA-input the desired graphic character. However, strange things happens.

The test code is as follows:

Code:
Private Sub TestTB_KeyDown(KeyCode As Integer, Shift As Integer)
Dim i As Long
If (Shift And acAltMask) <> 0 And KeyCode <> 18 Then
' For i = 1 To 20000000 this For-loop is initially commented out
' Next i

[code]....

The above code as it is works OK and the '#' is successfully inputted to the TextBox field.However, if I comment out the MsgBox statement, the program waits for about 0.3 second and then instantly fills up the entire TextBox field by a large number of '#' characters.

If I move the MsgBox statement to after the SendKeys, no '#' character is inputted to the TextBox.If I comment out the MsgBox statement and activate the For loop at the looping count amount (but not much less), the program works fine.

View 5 Replies View Related

Modules & VBA :: Capturing Events On A Frame Within Multi Page (tab) Control

Aug 23, 2013

I have a form with a tab control and an option group (frame). When I built the layout of the contents of the first tab, the frame responded properly to click events. Now that I have copied them onto the tab control, the events seem to disappear.

(When I check the events for the controls, they are all still there, and selected by the Properties table).

I know it's probably one of the "doesn't use Access very much, does he" type of situations, so how to get these controls working again!

Here is the Form Code listing.

Option Compare Database
Option Explicit
Sub SetSourceDescription()
If Me.frRunMode.Value = 0 Then
Me.lblSourceType.Caption = "Source for this run will be the Extract .pst file(s)"

[Code]...

View 3 Replies View Related

Modules & VBA :: Query Regarding Insert Future Date - Script Modification

Sep 12, 2014

I am dabbling in updating an existing database.Currently our staff enter data via a form and I have this set up using the below script to automatically complete the "Due date" field with a date 5 working days ahead of the current date, saving them from having to manually enter this date each time.

Code:
Public Function PlusWorkdays(dteStart As Date, intNumDays As Long) As Date
PlusWorkdays = dteStart
Do While intNumDays > 0

[code].....

This then updates the value on the relevant form object using the default value "PlusWorkdays(Date(),5)" to give a date 5 working days ahead. the problem I face is that due to our business process at 15:30 each day our due date needs to change to 6 working days from todays date rather than 5. I was wondering if there is a simple way I can modify the script to add an extra working day when the local time hits a specified point (15:30 in this case), unfortunately this is a bit outside my abilities currently!

View 3 Replies View Related

Modules & VBA :: Using Record Number In Where Statement

Jul 8, 2014

I have a form with a sub form based on a query, in one of the fields i use a dbl click to open another form. I have use this in several areas in my DB but i having issues in one section of it not opening to the correct record. i tried a few things but i am limited to what i can use. The Record_Number is an Auto number and CLASS_Num is an entered number buy the user.

I have 2 things that i can use but i can not get the Record_Number to work. When i use the Record_Number i get an Data Type Mismatch Error.

----------------------------------------------------------------------
Private Sub Combo10_DblClick(Cancel As Integer)
DoCmd.OpenForm "Documentation_Form", acNormal, , "[Record_Number] = '" & Me.Record_Number & "' and [CLASS_Num] = '" & Me.CLASS_Num & "'"
End Sub
-----------------------------------------------------------------------

View 3 Replies View Related

Modules & VBA :: Copy Record As New In Large Number Of Tables

Jan 20, 2015

I have "Master" table with fields "Job No" and "Revision No". Both together is a primary key, so that combination of both cannot be duplicated. I have 100 other tables to be related with referential integrity(+update&delete) to Master for both fields. Apart from Job No and Revision No, all 100 tables have different set of fields which is why I had to come with so many tables.

Due to 32 limit rule, I had to come up with workaround method to have all 100 tables in the relationship. So, I created 5 other SubMaster1, SubMaster2, ...., SubMaster5 which are related to Master with relationship with referential integrity (+update&delete). Then I assigned 20 tables to each SubMaster so that 20 tables are related to each SubMaster table.

Whenever I create new record in Unit, the new record is generated in each SubMaster using update query for each SubMaster table. I have all the forms and necessary query laid out. The only missing part is being able to duplicate a record. I have limited knowledge in VBA, but I should be able to modify it to address to my requirement.

I want to copy a given record in Master, SubMasters and 100 tables as a new record. I need this feature so that I can select certain Job No and Revision No and copy that as a new Job No(assigned manually in a form) and 0 as the revision number. Possibly a button which will ask for new job number and copy everything from the active Job No and Revision No to a New Job No and "0" Revision No. The existing record may not be there on all 100 tables for the given Job No and Revision No. If it is there, then copy otherwise ignore for each of the tables.

I have a table "ItemList" which lists all the unique name of the 100 tables.

View 8 Replies View Related

Modules & VBA :: Formula Based On Record Number - Recordset Required?

Dec 14, 2014

In order to arrive at the required solution I have to perform a calculation, using data from each successive table record (in chronological order). The result of each calculation must then be used to arrive at the result for the next calculation.

In other words I have to update a variable based on data from each record, sorted in chronological order, and use the final result to populate a field on a form.

Is it time to break out my copy of "VBA For Dummies" and start learning how to use Recordsets?

View 8 Replies View Related

Modules & VBA :: Copy Record N Number Of Times - Incrementing Date

Jun 3, 2015

Is it possible to copy a record 'n' number of times, incrementing the date by either days, months, weeks etc?

I have a regular payments table that will need to be edited at some point should either dates, or amounts change, but... regardless of the size of the table, it's not a problem, as these will be moved to a different table and deleted once paid.

Given the example, would it be possible to copy this record and additional 5 times, incrementing the date by one week.

View 11 Replies View Related

Modules & VBA :: New Record Button With Prefilled Number Based On Selection On Another Table

Jan 6, 2015

I'm making a database that so I can log calibration information about equipment every year.I have 2 tables:

The Equipment details table
The Calibration record table

ID Number is shared between the 2 tables so a calibration record can be linked to its' details.

For Example (simplified sample data):

Equipment Table
ID Item Unit Type
104 Thermometer DegC PT100

Calibration Table
ID Cal Point 1 Test Equipment Unit Under Test Date
104 20 21 22 06/01/15

What I want is a button on a form that creates a new blank record in my Calibration record table with the ID number already entered based on what record I selected in a combo box linked to my equipment table. I really don't know where to start.

View 2 Replies View Related

Modules & VBA :: Create Unique Reference Number Based On Field Values For Record

Jun 18, 2015

I want Access to automatically generate a reference number for a record based on the values in on two other fields for a given record using a form.

The first field is called Operation Number.

The second is Bag Number.

The reference number needs to be in this format: 19C.3.1

Where 19C is the Operation Number, 3 is the bag number, and 1 is automatically generated. Additionally I need the last number --the automatically generated one--to go back to 1 if with each new bag number.

This is kind of like library catalog numbers. Not sure how to do this.

View 2 Replies View Related

Modules & VBA :: Loop - Copy Current Record By Number Of Times Specified In Quantity Field

Sep 20, 2013

I would like to do a loop but never done one before, basically i want to copy the current record by the number of times specified in a quantity field

So if the quantity field in the record says 5 then copy that record 5 times (I have managed to create the copy and paste code but dont know how to make it do it 5 times

Code:
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
DoCmd.GoToRecord , , acNewRec
DoCmd.RunCommand acCmdPaste

View 2 Replies View Related

Modules & VBA :: Date Field To AutoPopulate Other Date Fields To Future Date

Oct 24, 2013

I'm trying to get my "IncidentDate" field to autopopulate two other date fields to a few days from the "IncidentDate". The other two date fields are "ContainDueDate" and "RootDueDate". I'm trying to accomplish this on my "Test CAP Form"

I tried using the following in the BeforeUpdate of "ContainDueDate" and received a complier error: expected =

Code : DateAdd(d,2,[IncidentDate])

so I removed the parenthesis and nothing happened

Code : DateAdd d,2,[IncidentDate]

I even tried redoing it in the AfterUpdate of "IncidentDate" and nothing happened either

Code : DateAdd d,2,[ContainDueDate]

I'm not sure if I'm even using the right function to get what I want.

View 4 Replies View Related

Tables :: Procedure To Restrict / Stop Auto Number Increment For Certain Number Of Record Count

Mar 16, 2014

I would like to know if there is any procedure to restrict/stop auto number increment for certain number of record count (say 50), then increment by 1 for next 50 records.

View 8 Replies View Related

Capturing F11 Press, Possible?

Sep 18, 2007

Hi,
I've read a few posts regarding removing the facility of the F11, open Db window, but is there a way to capture if someone presses F11?
I have a few people (users) who think they know a thing or two about Access and I'd like to know if/ when they're accessing the Db window.

I was hoping for the ASCI code or similar for the F11 key!?
Thanks
Matt

View 4 Replies View Related

Modules & VBA :: Sequence Number In Query Use A Starting Number

Sep 20, 2014

creating sequence number in a query using a starting number. For example i want to use the starting sequence number as 5

---SEQNUM---------COLOR-----------
-----5------------------blue--------------
-----6------------------red---------------
-----7------------------orange-----------
-----8------------------black-------------

View 2 Replies View Related

Capturing Changes When Form Closes

Jul 7, 2006

I have a form that records when a user edits a record. This change is only recorded when the user clicks the "update record/save" command button. What I need help with is capturing the changes made when a user edits the record in any field and doesn't click the save button upon closing the form. If the user doesn't edit any fields in the record, a new instance of this edit will not be saved to my edited records table and the form just closes

View 2 Replies View Related

Form For Capturing Data

Aug 1, 2006

Hi All,
I'm a novice to Access and I need some help developing a form page where by users can input and record daily project activities.

I have most of the form complete, however, i find that when a user accesses the page the previous record is sometimes showing. How do I setup my form page so that all fields are blank everytime? And how do I set it up so that a user can't scroll through records in the form screen.?

View 2 Replies View Related

Capturing Updates In Tables - Part 2

Nov 24, 2007

Could you answer a diabolical question? I am trying to track the changes of a record in a table when I have imported a text file.

I will import a txt file everyday and to that end I have wrote the code for the insert of new records into customer table and customer history tables and then the updates into the customer table.

However I will only be able to capture the updates in tables as there will be multiples. I understand that Jet can't capture the updates at the table level (no triggers).

So the diabolical question, is it possible to capture the updates only in tables using code??

Please help...

Many thanks

View 1 Replies View Related

Capturing A Date By Selecting A Button

May 16, 2006

Hello all.

We have product orders that get held in process for a variety of reasons (contract not signed properly, missing drawings, etc). It is our Order Processing Rep's (OPR) responsibility to review the requirements, follow up with the salesman, get the proper documents together and get the order released for product assembly. We capture the date the order was originally held with a date-formatted text field, and then we later capture the release date with a similar field, entered by the OPR.

The OPR is graded on the average time it takes to release a held order. Since they can enter text into the release date field, they can fudge their metric. I'd like to fix this by having a button on the form say "Order Released" and, when it is selected and verified by a second click, the date that occurs is captured in the table under "Release Date" but is hidden from the OPR's ability to edit it.

Can this be done? Any help is greatly appreciated!!

Tom

View 5 Replies View Related

Capturing Input To A Parameter To Use In Report

Jul 29, 2006

I have a report which asks for the beginning date and ending date which they want. The report is generated using this information. I want to put the information entered in the parameter request into the heading of the report. How do I recover this information to put it in.

Jerry Hughes

View 2 Replies View Related

Forms :: Capturing Who Amended Data

Mar 22, 2015

I am sure I am not asking a question that has not been asked before. I have a form and i can capture who edited the form using log in ID. But now the issue that is coming my way is that certain date field are more critical and we need to know who amended those dates and whether it is possible to find out what was the pre existing date?

View 14 Replies View Related

Capturing User Name From Form Field Entry

Feb 6, 2007

In this db, the users select their name from a dropdown in an auto-open form, but with no password. I want to capture this value for use as the default value in a field on another form, but with the first form closed. I have seen the ENVIRON(Username) function referred to many times on here, but I need to capture the entered value, not the Windows or network login.

Is this possible without leaving the form open? I suppose I could just set its Visible to False when they enter their name, but I try not to have any more windows open than are necessary.

THANKS for your help!!

View 8 Replies View Related

Update Query For Capturing Log Out Time Of User

May 18, 2006

I have done some searching to find a method for logging & timestamping when users log in and out. I have no problems with capturing the Log IN information my problem lies with the log out portion where I am trying to use a Update query to update when the user logs out of the database:

I can get the update query to do what I want, but for some reason it is creating a duplicate record (exactly the same as the last record updated)

Here is the code I am using:

UPDATE LogInTable SET LogInTable.LogOutTime = Time()
WHERE (((LogInTable.LogOutTime) Is Null) AND ((LogInTable.UserName)=LogUserName()));


Basically I am trying to tell the Query to ONLY update records where the "LogOutTime" is Null AND where the UserName field in the table = the username of the person trying to run the update query.

Please help I can't figure out how to prevent these duplicates. :(

View 9 Replies View Related







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