Need to loop .wav file three times. (See "Sound") (Not tagged in origional code.)
Private Sub Address_Exit(Cancel As Integer)
Address.BackColor = 16777215
On Error Resume Next
'If there is no matching record in communications do nothing.
If IsNull(DLookup("[address]", "communications", "[address]='" & replacequote(Me![Address]) & "'")) Then
Exit Sub
End If
'Make button visable and activate alert beep.
Command1796.Visible = True
PlaySound "H:GeneraldmediaBEEP_FM.wav", ByVal 0&, SND_FILENAME Or SND_ASYNC
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
I have a VBA routine that runs some queries and then creates a report as a PDF document using my virtual PDF printer. At this point it brings up the Save As dialog and I give the file a name and select a folder to store it in.
But I run this report 30 times for 30 different parameters. The parameters are obtained from a table which contains values such as Cancer, Diabetes, Stroke
-I always name the PDF file according to this value. -I always choose the same folder. -I always overwrite the reports I produced last month (copies have been sent elsewhere by then).
how can I get VBA to cycle through this code 30 times, each time selecting the next value from my table and creating/overwriting those files without the need for me to tell it the filename and path?
Code: Private Sub lstSpecialties_DblClick(Cancel As Integer)
At the moment I am running this code by double-clicking an entry in the Specialty listbox, 'but I would prefer the whole thing to run multiple times for as many Specialties as exist in the table '(currently 30 but could be more in time)
'Warnings off DoCmd.SetWarnings False 'Make the tables needed for the cumulative queries DoCmd.OpenQuery "Spec 002 Monthly recruits - part 2 - make table" Each of these queries DoCmd.OpenQuery "Spec 005 Monthly recruits - part 2 - make table" uses the Specialty selected above DoCmd.OpenQuery "Spec 022 ABF previous year - part 2 - make table" as a parameter to get DoCmd.OpenQuery "Spec 025 ABF current year - part 2 - make table" the right data for the report
I am using MS Access 2010. I have a code that I am using that loops through a folder gather all the names of the files in the folder and inserts them into a table (shown below). The table is named "tblFiles" there are two columns in the table titled file name and file path. What I want to do is to also loop through the same folder to find the file path of the files and insert them into the file path column has a hyperlink where users can just click on the hyperlink and the file opens.
Private Sub Form_Load() Dim fs, f, f1, fc, s Dim rs As DAO.Recordset Set rs = CurrentDb.OpenRecordset("tblFiles")
We use a device called a site master to test frequency levels across a system. This device stores plots onto graphs which are then downloaded onto an Access (95) database. When the plots are captured before they are put into the database they are time and date stamped among other things. When I open the Database in access I can go into the fields and physically change each of the dates. Yet when I use the site master software to open the database the Time and Date stamp appear at the bottom as the original values and not the changed values that I have assigned. Also when you right click the plots table and go to the properties. The created and modified dates have stayed as the originals. What I would like to be able to do is adjust this date. And what I would like to know is this possible??? Is it like a Windows File 'System' that is giving this date or is it a function in Access that can be changed?
I have a query that sums downtime on equipment. The problem that I came across is that there can be multiple status items open up on the same piece of equipment. When the restored time on one status item occurs after the down time of another, the query still adds the total down time of both status items which is giving me greater downtime than there actually is.
I work for a chemical company, over the course of the day there are 2 shifts, one from 07:00 - 19:00 and the other from 19:00 - 07:00. I want to measure the amount of time a piece of equipment has been offline for, and Sum these times for each shift, these pieces of equipment can go offline multiple times per day which is why I need the sum function. The fields I currently have are:
[Date1] : The date at which it went offline [Time] : The time at which the piece of equipment went offline [Duration] : The length of time it was offline for
For each day I wish to sum the offline time in two fields called:
[Shift 1]: The previous nights shift (between 7pm the day before and 7am that day). [Shift 2]: The days shift (between 7am and 7pm that day).
Where to begin but the logic should be something like:
[Shift 1] = Sum of [Duration] For(([Date1]-1 and [Time] between 19:00 and 23:59) And ([Date1] and Time between 00:00 and 07:00))
[Shift 2] = Sum of [Duration] For([Date1] and [Time] between 07:00 and 19:00)
I currently have two tables storing all this data, one containing [Date1], and another containing the breakdown information such as [Duration], [Time] etc. They are linked by the [Date1] relationship. The reason for the first table only having the [Date1] field is because it is a Main Form which contains various sub-forms.
I am trying to build a query that depending on the value stored in a combo box called SHIFT, either lists all the entries that have been made by our dayshift (07:00-19:00) or our night shift (19:00-07:00)
Each of these components work if I seperate them out
IIf([forms]![FRMFRame74]![SHIFT]=1,Between #07:00:00# And #19:00:00#,Between #19:00:01# And #23:59:59# And Between #00:00:00# And #06:59:59#)
I have a database that keeps track of training hours for each employee. The Training Length is formated as Short Time. I just figured out that short time can only go up to 23:59:59. Some of my trainings will be over that. Does anyone know a way to get around other than splitting up my hours and Mins in the table?
Just practicing at the moment, but i have a query that stores durations in hoursminutesseconds
Anyway i want the query to add these times up and give me a total. For example 01:00:00 and 01:00:00 would total up to 02:00:00. Hoever when i use the sum function within the query, i get 0.0833333333333333.
Any idea why and do i have to format the field within the query to recognise it as a Time and not a number?
Worked Hours: DateDiff("h",[Start Time],[Finish Time])-[Breaks]
Start time and finish time appear as hh:mm and breaks is stored as a decimal i.e. 15min is 0.25, 30min is 0.5, 1 hour is 1.
The expression works fine when e.g Start 07:00 Finish 17:00 with breaks as 30min(0.5) gives the correct value of 9.5 hours worked but if the finish time was say 17:30, rather then show the correct value of 10 hours worked, it shows the wrong value of 9.5.
Could someone please tell me where I have one wrong and how to sort the problem, or offer me a different solution.
I am really new at access 2003 and queries s forgive me if this question is really dumb/simple/confusing...here goes
I created a query where I ask the user to provide the info for the date range..<[Before date]
it worked fine.
I then added something to the database and ran it again and it now asks me for my date not once, but twice..i then copy and paste query with a new name and it asks me for the same info 4 times
ok so im not sure how to explain this but ill give it my best shot.
I have an excel sheet that has a list of order info. heres a sample of what it looks like:
70144:37.0Starting order split <34010993;01>gregory_pm34010993 70245:16.0Script complete for <34010993;0106>Rx <24073318>gregory_pm34010993 70103:37.0Starting order split <34010995;01>knox_br34010995 70204:26.0Script complete for <34010995;0101>Rx <24239630>knox_br34010995 70126:49.0Starting order split <34011015;01>flander_ar34011015 70232:09.0Script complete for <34011015;0101>Rx <24008174>flander_ar34011015 70134:01.0Starting order split <34011015;01>flander_ar34011015 70127:08.0Starting order split <34011061;01>flander_ar34011061 70227:26.0Script complete for <34011061;0105>Rx <24240139>flander_ar34011061 70227:55.0Script complete for <34011061;0103>Rx <24240083>flander_ar34011061 70152:00.0Starting order split <34011173;01>parker_tp34011173 70252:46.0Script complete for <34011173;0101>Rx <24071140>parker_tp34011173 70103:35.0Starting order split <34011369;01>sexton_pa34011369 70204:00.0Script complete for <34011369;0101>Rx <24240569>sexton_pa34011369 70149:02.0Starting order split <34011668;01>knox_br34011668 70250:59.0Script complete for <34011668;0104>Rx <21441348>knox_br34011668 70134:20.0Starting order split <34011764;01>hicks_jo34011764 70234:44.0Script complete for <34011764;0102>Rx <22787965>hicks_jo34011764 70235:06.0Script complete for <34011764;0101>Rx <22787933>hicks_jo34011764 70236:11.0Script complete for <34011764;0103>Rx <22788283>hicks_jo34011764 70156:45.0Starting order split <34011855;01>knox_br34011855 ______^this line is the time
ok so here is my problem. I need two records, one for the start of the order(the earilest time) and one for the closing of the order(the latest time). I also need the time inbetween the two.
Hi again everyone, With help on my first question Ive now got my cascading combo boxes working to a stage that shows all the information I need,
Currently Ive got 4 cbs and they work bring in and updating depending on what is selected in the previous etc etc.
combo1 = 2 combo2 = 5 combo3 = null combo4 = null
how can I tell it to use combo2 since there is no values selected in 3 and 4
Ive currently got the combo boxes in a form of their own, basically in my main form Id like to be able to click on a button to update a value, and then it will bring up the form for the combo boxes, then id select the values till I had what i needed, and then it would fill in the value on the main form with my selection from the combo boxes,
to make it abit harder, on the main page, there is 3 values that will need to get their value from the combo boxes, will that just mean I have to make 3 forms with the combo boxes in them, one for each of the values on the main page, or could I just have one form and maybe put a button saying (Use this Selection for Value 1)(Use this Selection for Value 2) etc etc.
Ive looked through the net alot and cant seem to find any examples that suit my question... but if anyone knows of a good example that would be awesome.
I have my data updated 3 certain times in a day. So i dont want to bother opening the same access 3 times a day. That access can be opened whole day no problem for me. So, how to run macros automatically in a time which I determine before ?
I hopeing that someone could help me with a Loop problem. I am trying to create a directory on each name change. My code works for the first name, however, when I am trying to Loop through the table, it isn't working.
Here is my code
'MkDir "H:NewPrivateFolder"
On Error GoTo Err_cmbMkDir_Click
Dim DirName As String Dim response As String Dim folder As String
If MsgBox("OK to create folder!", vbOKCancel) = vbOK Then
MkDir DirName
Else MsgBox "Create folder cancelled. Folder not created." Exit Sub End If Else MsgBox "The folder already exists..." & Chr(10) & "Please check the directories using Windows Explorer.", vbOKOnly Exit Sub End If 'response = MsgBox(DirName, vbOKOnly)
Let's say I have 10 variables (ID1, ID2, .........,ID10) In java, I can use a while loop as follows to go through each variable
For example: i=1 j=1 while (j<=10) { ID+i = 0 //this is some type of initialization of each var to 0 i = i + 1 j = J + 1 } What would be the equivalent code in VBA, especially for "ID+i" ?? I use the '&' symbol but it concatenates everything meaning in the first loop goes to ID1 (which is correct), the second loop goes to ID12 (which is NOT correct), the third loop goes to ID13 (which is NOT correct either), and so on.
I have a form that has a command button that requeries to the next days events. I want to skip days where there are no events. I created the Do Loop below but need it to stop after 10 days and return a MsgBox that says there are no further events.
I tried Do Until EOF but since the query is empty is fails. I have searched and read some other sources and did not find anything on limiting a loop the way that I need it. Or at least the way I understand it.
Any Ideas?
Forms!frmmain!txtSortdate = Forms!frmmain!txtSortdate + 1 If DCount("*", "qryflypages_old") <= 0 Then Do Forms!frmmain!txtSortdate = Forms!frmmain!txtSortdate + 1 Requery Repaint Loop Else Requery Repaint End If