Modules & VBA :: Create Multiple Records Based On Date Range - Button Click Event

Jul 31, 2014

I work for a company that manufactures home appliances & electronics. When those products fail within the warranty period, we are obligated to repair the units for the customers.

We have around 200 factory technicians who make those repairs. Each tech is able to make approximately 8 repairs each day. We have a dispatching system that assigns the repairs to the techs based on their availability each day. But the problem is that we have to manually enter and adjust the schedule for all 200 techs every single day, and this takes a lot of time. And of course technicians get sick, take vacation, etc, so we have to adjust the schedule so no techs will be assigned calls when they're off.

The problem: For example, currently when a technician takes off for 2 weeks, the user has to enter 14 individual records for the tech, which is somewhat time consuming. What I need is to program a button click event to determine the two dates (startDate & endDate) and append multiple records from one single entry in the form for each date in between and including the two date fields.

I know I'll probably need to create a loop that will loop through the two dates on the form and append a record for each day, so I can then cross reference the dates to the master schedule dates to make sure that no availability is opened for the techs taking time off.

View Replies


ADVERTISEMENT

Create Multiple Records Based On Date Range

Jun 28, 2006

I have developed a Debt Management program for work but I am stuck on a feature that we need to add to it. Basically I have a table which holds "planned future transactions". These are ad hoc transactions that need to be added from time to time to the clients budget. For example the client might have $500 a quarter for school fees for the next two years or he might receive a bonus every six months for the next 5 years. Currently we are putting these in manually but it is tedious and is causing complaints. The feature I require is to be able to add a record such as the school fees, nominate that this fee is paid every three months for the next 8 quarters and get the system, say through an append query? to create 8 records, each with the appropriate date 3 months after the previous one.

Any suggestions or assistance would be appreciated.

Thankyou

View 1 Replies View Related

Queries :: Update Multiple Table Records With Button Click Event

Oct 29, 2014

I have a table with many records, using a form with an update button click event, I would like to update ALL records where the Item in the table = the Item in the form.

There are 6 checkboxes and 6 text boxes that will need to be updated, but right now I am just trying to test if i can even change one text box to keep it simple. I have tried to start by using this:

Code:
Dim mySQL As String
Dim ItemNo As String
Dim SO As String

mySQL = "UPDATE BT200 SET Part = '" & SO & "' WHERE Item = " & ItemNo
DoCmd.RunSQL mySQL

So every time i run this command button, it gives me a prompt "You are about to update 0 row(s)". Nothing gets updated at all, I am clearly missing something vital here.

View 7 Replies View Related

Modules & VBA :: Exporting Multiple Queries Based On Date Range

Aug 29, 2013

I have recently set up a button that exports multiple queries to one Excel file, using TransferSpreadsheet code. This works great and saves a lot of time, the only thing is on many of the queries I have a date range set, so you have to enter a date range to get the results.

Is there away that once I press the button I enter the date range once and than it exports the rest of the data based on this range, rather than entering the same dates multiple times.

View 1 Replies View Related

Modules & VBA :: Count Number Of Unique Records Based On Range Of Date

Jan 19, 2015

Code:
' count records in query
Dim rs As DAO.Recordset
Dim db As Database
Dim strSQL As String
Dim beginDatum As String
Dim eindDatum As String
Set db = CurrentDb

[code]....

View 4 Replies View Related

Modules & VBA :: Query Records By Current Date Then Email Results On Button Click

Feb 26, 2014

I am trying to query my records by the current records selected date then send the results in the body of an email on click. I believe I am close but I think there is a problem with the date format because I am getting 3421 Data type conversion error. Here is what I have:

Code:

Private Sub eMail_Click()
On Error GoTo EH
Dim dbExceptions As Database
Dim rstExceptions As Recordset
Dim dbDate As Database
Dim rstDate As Recordset

[code]...

View 3 Replies View Related

Modules & VBA :: Creating Multiple Records Using Button - Text Box To Say How Many To Create

Jul 22, 2015

I am looking for a way to enable a user to fill in a number of fields on a form press a button(CreateButton) and duplicate the records how ever many times is stated in a text box(TxtQty). I also need this to increase the serial number by the amount of times stated in the text box.

There will need to be another text box (TxtNextSerialNumber) stating the next first available serial number

For Example:
TxtNextSerialNumber = AD-Oracle-00010
TxtQty = 5
Press CreateButton to create 5 records
TxtNextSerialNumber = AD-Oracle-00014

5 new records created with the below fields duplicated and the above happening.

I will then need a message box informing the user of the serial numbers created:

'You have created serial numbers AD-Oracle-00010 to AD-Oracle-00014'

Table Name: ADOracle
Form Name: ADOracleTestData

Fields Names:
CustomerName: Duplicate
PartNumber: Duplicate
OrderNumber: Duplicate
OrderDate: Duplicate
HoseKit: Duplicate
Returns: Duplicate
Comments: Duplicate
SerialNumber: + the amount shown in TxtQty starting on next serial number available.

View 6 Replies View Related

Modules & VBA :: Function Returning Max Value - Button Click Event

Dec 8, 2014

I have a table EmployeeInfo containing three fields

EmployeeId
Name
FatherName

I have created form for this table.

I do not want to use autonumber for employeeid for some reasons. I want to place a button along employeeid test box on form.

User will click on the button it will get max employee id from employeeinfo table and add 1 and copy it into employee id text box.

What will be the code for button click event.

View 2 Replies View Related

Modules & VBA :: Office 2010 / Click Button Event Doesn't Run Code

May 27, 2014

In the Main Form , I have few buttons and I am writing the following code to open the right form when a button is clicked but unfortunately the code isn't doing anything. No form is opening. I am using MS office 2010.

Code:
Private Sub BtnOption_Click()
DoCmd.OpenForm "Form1", acNormal, , , acFormAdd, acDialog
End Sub
Private Sub Form_Load()
'Me!Label1.Caption = "Welcome " & Environ("username") & "!"

[code]....

View 14 Replies View Related

Use Vb To Create New Records Based On Number Range

Apr 16, 2014

I am looking for a way to use vb, or any other way, to allow my users to enter a railcar initial and then a number sequence and add new records to the end of the table.

For example in a form the user can enter the car initial and the number sequence
Railcar initial: GATX
Number sequence : 290001 - 290100

I would like a way to create a temp table that then has 100 records
GATX 290001
GATX 290002
GATX 290003
etc etc.

I can then use this temp table in an append query to add them to my main table.

View 7 Replies View Related

Forms :: Button Click Event To Choose Between Forms To Open Based On TextBox Input

Jun 7, 2013

Making a small database, Got 1 Table.

1. ContactDetailTable

Got 3 forms.

1. ContactIDForm
2. ContactInfoForm
3. NewContactFrom

In ContactIDForm it contain 1 textbox name 'TextBox' with Button Name 'Btn'

In ContactIDForm there is only 1 Text Box ContactIDTextBox and 1 Button. User Enters ID in TextBox and On Button Click Event it should check data from TextBox in Table name (ContactDetailTable) in field ContactID and if there is record matching, ContactInfoForm should Open else NewContactForm should open with ContactIDTextBox value in it.

View 10 Replies View Related

Modules & VBA :: Import Multiple Files To Multiple Tables On Button Click

Sep 20, 2014

I made a database that in one of the forms, I like by clicking on a button the user be able to select 5 excel files with different file names (in the same directory) and then based on the imported file's names, it be stored in 5 different tables.

At the moment by using the bellow code, I can import multiple files (with the same formats) only into one table . My vba code comes as follow:

Function GetAllFiles()
Dim fd As Object
Dim strFilter As String
Dim lngItems As Long

Const msoFileDialogOpen As Long = 3
Const msoFileDialogViewDetails As Long = 2

[Code] ....

View 4 Replies View Related

Modules & VBA :: How To Run Multiple SQL Commands On Click Of A Button

Jul 25, 2013

I want to run multiple SQL commands on click of a button. I have these three command,

CurrentDb.Execute "INSERT INTO UserMadeDeviceT(Product, ORESector) " & _
" VALUES ('" & Me.D_NewDeviceTxt & "', '" & Me.D_ORECmb & "')"
CurrentDb.Execute "INSERT INTO UserMadeDeviceT (RatedKilowattPower, KilogramWeight)" & _
" SELECT RatedKilowattPower, Weight FROM UserSelectedComponentT " & _
" WHERE [TotalComponent] = '" & D_ComponentNameCmb & "'"
CurrentDb.Execute "INSERT INTO UserMadeDeviceT (Cost) SELECT SUM (EuroCost) FROM UserSelectedComponentT"

all of these work indevidually and return the correct value but the add three rows to the table. How can I combine these three commands into one so that it will only add one entry?

View 8 Replies View Related

Parsing A Record Into Multiple Records By Date Range

Sep 1, 2015

I have a record in a table (Table1) with the following:

Item Start End
A 2012 2030

I have another table (Table2) with the following:

Item Start
A 2018

A 2025

What I would like to do is update/append Table1 so that it looks like the following:

Item Start End
A 2012 2017
A 2018 2024
A 2025 2030

View 4 Replies View Related

Modules & VBA :: Form Bound To A Table - Button Click And Then Date / TimeStamp

Jun 30, 2014

I have created a form that is bound to a table.

There is a button on the form that allows users to send email with the form as an attachment in pdf. I'd like to create a date/time stamp in another table called tblLog. Trouble is the code works uptil sending emails but it doesn't record the stamp.

Heres what I've done so far.

Private Sub cmdEmail_Amd_Click()
On Error GoTo cmdEmail_Amd_Click_Err
DoCmd.OpenForm "frmAmendment_Master", , , "[Record_ID]=" & Me.Record_ID.Value
DoCmd.SendObject acForm, "frmAmendment_Master", "PDFFormat(*.pdf)", "", "", "", "Amendment Form" & " " & Surname & " " & Firstname, "", True, ""

[Code] .....

View 3 Replies View Related

Modules & VBA :: Filter Subform In A Form Based On Date Range

Jul 26, 2015

So I have a search form that I created that has also a subform (a continous form, that has a query as its source) where my records are listed. I started on making a Between dates filter where i would be able to pick dates and get the results of records that are in that range.

I put two text boxes in which I set format to Short Date so that I get the button to select the date from a calendar for each text box. Then I made a button that is only for this and added a Clickon code so that it filters my subform over the recordsource of the form. The problem is is that i get an error and it doesn't filter.

Code:

Private Sub btnDatumUpis_Click()
Dim SQL As String
SQL = "SELECT qrySearchV.VID, qrySearchV.MarkVoz, qrySearchV.ModelVoz, " _
& "qrySearchV.TipMot, qrySearchV.Regist, qrySearchV.VlaVoz, " _
& "qrySearchV.KorVoz, qrySearchV.KatV, qrySearchV.DatumUVoz, " _

[Code] ....

View 5 Replies View Related

Modules & VBA :: How To Select Records By Date Range

Nov 30, 2014

I am trying to create a form that will select records by date range. The form contains 2 textboxes, with pop-up calendars to select dates. I managed to come up with this code, however, it's not working. Whenever I run the code, my database just goes blank, as though it's selecting something that is not in the records.

Code:
Private Sub Command16_Click()
Dim Task As String
Dim startDate As Date
Dim endDate As Date
startDate = Me.Text12
endDate = Me.Text14

Task = "SELECT * FROM Final WHERE Final.Timestamp BETWEEN #" & startDate & "# AND #" & endDate & "#;"
Me.RecordSource = Task
End Sub

How does one actually do the date range search? Could it be because my timestamp actually has both date and time, that's why the date search is not working?

View 5 Replies View Related

Forms :: Button Click Event On Continuous Form

Nov 25, 2013

I have a continuous form with a button 'Cmd1' & a textbox 'txtMail' which is set to visible no.

When the user clicks Cmd1 - then txtMail becomes visible.

I can do it using vba on the buttons click event but when it executes txtMail for all the records become visible.

How do I use a button's click event on the form's current record - Private Sub Form_Current() so that when the user clicks Cmd1 on the current record only txtMail for that record becomes visible.

I'm using Access 2007.

View 10 Replies View Related

Reports :: Opening Form Based Off Of Double Click Event On Report

Aug 15, 2013

I have a main Form "Client" that shows details such as Representatives, phone numbers, status, etc. I also have a main report "CRM" that is a nicer summarized table version of all of my Client form entries.

The "CRM" form will be used by others in my office to see what clients we are contacting, etc. What I want to be able to do is have someone open the CRM form first. If they want to see even more specific info (not everything is included in the report, as that would be too messy), I want them to be able to double click the Client's name on the report and be taking to the corresponding entry on the Client form that shows more details.

Right now my code for the Report which is not working is the following:

Private Sub Client_Name_DblClick()'double click on a client name in the reportDoCmd.OpenForm "Client", acNormal, , "[Client_Name]='" & [Client_Name]'this should open the Client Form to the record of the same client that was double clicked on the reportEnd Sub

View 14 Replies View Related

Forms :: Date Control On Click Event

Sep 19, 2013

I have a date control and on the Click event I run the following code. Trouble is the Date Control stops working, ie you can't change the date after one click ?

CODE.

Private Sub Calendar7_Click()
weekofyeartxt.Value = DatePart("ww", Calendar7.Value)
End Sub

View 3 Replies View Related

Modules & VBA :: Command Button Press Multiple Times Based On Value In Text Box

Jul 23, 2015

Is there any way to press a command button a certain amount of times based on a value in a text box.

i.e.

text box value = 5

button gets pressed 5 times with one click...

View 14 Replies View Related

Create A Filter In Onclick Event Of A Button

Jul 14, 2015

I have two fields [InReview] and [TestReviewed].I'm trying to create a filter in the Onclick event of a button like so:

Code:
Me.Filter = "InReview Is Not Null" & "TestReviewed Is Not Null"
Me.FilterOn = true

This is not working for some reason. What is the correct way to concatenate a filter in VBA?

View 2 Replies View Related

Queries :: Create Sums Based On Weekly Range?

Jun 26, 2014

I'm creating a query for a someone who wants quantities summed by a weekly range and correspond to a week number. This person wants Access to do something that is a simple function on Excel.

I have no clue how to do this or if Access is even made to do something like this.

This is an example of what I have so far

Quote:

P/N QTYWork DateWW (Work Week)
25COMP16/11/201428
25COMP26/20/201425
25COMP27/9/201428
25COMP36/20/201425

....And so on

My code is

Code:
SELECT dbo_JBKLG.JKPRT AS P/N, dbo_JOB.JBQOR AS QTY, CDate(Mid([JKDDT],5,2) & "/" & Right([JKDDT],2) & "/" & Left([JKDDT],4)) AS [Work Date], DatePart("ww",[Work Date]) AS [WW]
FROM dbo_JBKLG LEFT JOIN dbo_JOB ON dbo_JBKLG.JKJOB = dbo_JOB.JBJNO
GROUP BY dbo_JBKLG.JKPRT, dbo_JOB.JBQOR, CDate(Mid([JKDDT],5,2) & "/" & Right([JKDDT],2) & "/" & Left([JKDDT],4))

There are more part numbers and the data from the other parts must be in the same format in the same query.

Quote:

P/N QTY WK WW

25COMP 15506/09-06/15WW24
25COMP 22706/16-06/22WW25
25COMP 16006/23-06/29WW26
25COMP 20006/30-07/06WW27

.....And so on

View 14 Replies View Related

Modules & VBA :: Checking For Key Presses In On Click Event

Jul 25, 2014

I have a button on a form and I want the On Click event behind it to check whether Shift is also being pressed when the user clicks the button (or Ctrl, or Alt, in fact any damn key will do).

I can't believe that there isn't a function in VBA like the old 1980s BASIC 'inkey' function (etc) that just simply returns the code of any key being held down at the time of the scan. I shouldn't have to mess around programming other events like KeyDown and KeyUp when I don't particularly need the key-press to trigger an event per se.

View 7 Replies View Related

Modules & VBA :: Event Handler For Mouse Right Click And Select?

Aug 11, 2014

I want to handle the event when I right click and choose "Paste" to pop up a message to the user that he cannot paste; disabling the pasting functionality.

I understand that the Button parameter refers to right or left button , but on which event to best use (mouse up ,mouse down , mouse move - as it seems to be a mixture of the three) and the code for that event.

Code:
Private Sub List_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
' See if the right mouse button was clicked
If Button = acRightButton Then
'DoCmd.CancelEvent
'do event here
End If
End Sub

I don't want to cancel after there is a right click , but rather after right clicking and choosing "Paste".

View 9 Replies View Related

Modules & VBA :: Where To Place Code That Run Constantly Without Event Such As A Click

May 26, 2015

I'm currently trying to make the call answering screens a bit better in the call centre that i work in. i'm trying to make a caller i.d. for incoming calls. i have a reference library from the telephone software people in vba that lets me dial and hangup the phone, now i'm trying to place a text box on the form that will update to show the number of an incoming call which will enable me to search a table of contacts and display the details of the caller if they are available. i'm guessing that i need to create a loop that will run until there is an incoming call but i don't know where to place the code without it needing a mouse click or mouse over to trigger it. i just want it to run constantly.

View 5 Replies View Related







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