Modules & VBA :: Editing Sleep API To Lookup Cell For Length Of Pause

Nov 8, 2013

I am creating an Electronic Medical Records database (well, a fake one, for medical simulation purposes). The way it works, you select a patient from a drop-down on the "Selection" form, and click a command button to bring you to a "Patient information" report. From that report you can view EKG's , Lab results or Imaging reports.This database is to be used for medical simulation for medical students. So for i have command buttons for each report, and a check box to "order tests".

When a test is ordered , i have the command buttons linked to go to a different report that appears the same except it has a subreport with the "new" test results in it. If this were an actual hospital , results would not be instantaneous, so i have the sleep api in for the "on load" for the reports with the "new" results.

I would like it so I could enter how long of a delay i want for the loading of a particular report in the dataentry form i have. But I am not the best at VBA, and I cannot seem to figure out how to get the sleep api to get the value for the number of seconds i want to wait from my table.

View Replies


ADVERTISEMENT

Help On Pause/sleep/etc.

Mar 11, 2006

Hi,

is there a way to tell access to do REALLY nothing, like a sleep command?

on a form, I wanted to make a slideshow button which would skip to the next record after some seconds. but in those seconds i need to display 2 graphs and there is the problem i'm facing.

using something like a loop makes access really busy (as a process) and graphs use a different process (graph.exe) and that process doesn't get any processingtime...

anyone?

View 3 Replies View Related

General :: Adjust Cell Size According To Length Of Data In Datasheet

Jul 9, 2013

I have subform (Datasheet) is there some code e.g. after update, which can adjust size cell to lenght of data?

View 11 Replies View Related

Modules & VBA :: How To Pause Code When Calling Custom Message Box Form

Feb 9, 2014

I have created a custom message box form that suits my needs for this particular situation. It is called (opened) in the middle of a bunch of other VBA procedures. What I am having a problem with is how do I "pause" the rest of the code from running after the message box call?

For example, with a regular msgbox() function, once called, the code will wait for the user input or click of a button, then continue. My problem is that I am using the basic docmd.openform procedure, and it opens the message box form just fine, but then continues on with the rest of the code after the form is opened.

How would I "pause" the code after the call of opening my custom message box form, then continue it after the user clicks one of my closing buttons from that form?

Furthermore, although its not entirely needed in this situation, for future reference, how would I have that message box form return a value to the calling procedure?

View 14 Replies View Related

Lookup Field / Combo Box - Changing Colour Of A Cell?

Mar 7, 2012

I have a Lookup field/combo box and want to have the cell colour change if a certain word is chosen. if not then the cells stay the same.

i.e., if "cancelled" the cell turns red, if any of the other two options are chosen, then leave as is.

View 3 Replies View Related

General :: Pause And Resume Time Calculation

Sep 17, 2013

I am working on a database where i need to perform the below activities,

start->pause->resume->pauseagain->resumeagain->finish

I wanted to calculate the actual time from start to finish excluding the pause time.

View 3 Replies View Related

Modules & VBA :: Add Text To Make Max Length In Field

Sep 26, 2014

I have 2 fields in a query which I want to write to a table. Eg ProductName (field length 10) and Product Code (field length 5) the fields need to be filled out so the length makes the maximum text

For example product name 'test' length is 4 i have to add 0 to make the length to 10 so the field will be 000000test same thing applies to Product code. I have 700 records like this, is there a way in VBA where it adds the extra text to make it the maximum length.

View 14 Replies View Related

Modules & VBA :: Check Length Of A Field Value In The Table

Jul 29, 2015

I have a table that stores ID,PolicyNumber,NewPolNo fields.It has millions of records. The field NewPolNo is empty. I need vba code that will check the following for each record:

1. If the length of the PolicyNumber is over 14 characters long then store that PolicyNumber value in NewPolNo field.

2. If the length of the PolicyNumber is less than 14 characters long thenagain store that PolicyNumber value in NewPolNo field.

3. But if the length of the policyNumber equals to 14 digits long then check the following:

a) If the last 7 digits are 0's of that PolicyNumber. If yes then store first 7 digits in NewPolNo field.
b) If the last 7 digits are not 0's then store the whole PolicyNumber value in NewPolNo field.

We need to check these conditions for each record of the table.

View 1 Replies View Related

Modules & VBA :: Retrieve Datasheet Cell Color?

Sep 29, 2014

I'm using conditional formatting on a datasheet to change the background colour of a cell. Is is possible to retrieve that colour?

View 6 Replies View Related

Modules & VBA :: Increment Variable Length Alpha Numeric Field By 1

Jul 8, 2013

I have a database that is used for tracking changes to numerous courses. Part of this database create a unique tracking number for each course problem developed. Currently I have the form do a comparison using the highest most number to compare against the current number assigned and prevent the form from saving until the number is incremented and not a duplicate, it would be a lot easier if I could just have it increment plus 1. I have seen various answers but they all seem to depend on the alpha portion of the field being a set value, in my instance it is variable in length. The only part that is fixed is the last four characters to the right which are the numeric portion I would like to increment. For example the field can equal:

QACP-M-PIQ-6059
QACP-M-PREF-6002

how to extract just the numeric portion, increment it by one and save?

View 2 Replies View Related

Modules & VBA :: Display Cell (B1) Value In Sheet1 Of All Workbooks In Message Box

Feb 24, 2014

I have a form and there is a command button on it. I want the code that will run when that commandbutton is pressed and it should check the first sheet "Sheet1" in all the workbooks in the folder C:FolderTemp.

And if the first sheet name is not "sheet1" then just ignore that workbook and move to next workbooks. If the first sheet name is "Sheet1" in a workbook then display the value present in cell B1 in a message box.

So if there are 5 workbooks in the folder C:FolderTemp and two of them hasn't got first sheet named "Sheet1" then display value of B1 in rest of the 3 sheets in a message box one by one.

View 2 Replies View Related

Modules & VBA :: Autofill Cell Based On Previous Record Value

Aug 26, 2014

I am trying to write some vba code to auto fill a cell's value based on the value of the cell in the previous record (In a datasheet form) i.e. if the value in record one was '1' and the down-arrow key was pressed then the value '2' should be entered into the new ext record

I have written some pseudo-code to show what I am trying to accomplish:

if keydown = down-arrow and current cell contents isnumeric then
Cval = current cell contents
if current record = last record then
create new record
move down 1 record
set cell value of new record to cval+1
else
move down 1 record
if cell value = null then set cell value of record to cval+1
end if
end if

View 14 Replies View Related

Modules & VBA :: Concatenate Data In One Cell In A Report / Query

Mar 27, 2014

Watch the below tables.

I have a large ACCESS list as per the left one and I would like to make it as per right.

The problem is that I want to concatenate the "invoices" in one record separated with a coma , .

This is the only way I can compact the long list into a short one and make it comprehensible.

The invoices , in one cell, very rarely are more than 4 or 5 items.

So room for 6 is just perfect.

View 8 Replies View Related

Modules & VBA :: Passing Excel Cell Date To Access Query

May 1, 2014

I'm having a rough time trying to figure out how to pass a date to an SQL statement that Excel VBA macro will run. The date is in a cell (A1) formatted as 'm/d/yyyy'. Let's say it's 2/1/2014. I want to run an SQL statement that retrieves data from a table where a field is greater than 'A1'. The table field is a date/time field and has values formatted as 'mm/dd/yyyy'.

I've tried various syntax on the Where but cannot get it to work.
sd = Range("A1")
SELECT [tn].[Date Submitted]
FROM[tn]
WHERE tn.[Date Submitted] > """ & sd & """

This results in the following where clause that does not work.
WHERE tn.[Date Submitted] > "2/1/2014"

View 4 Replies View Related

Modules & VBA :: Excel File Export Auto Cell Width?

Jun 26, 2014

I have the following code to export a query into a excel file:

Code:
Dim outputFileName As String
outputFileName = "C:AccountSpreadsheet est.xls"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Q_Search_Invoices", outputFileName, True
Dim xlApp As Object
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
xlApp.Workbooks.Open "C:AccountSpreadsheet est.xls", True, False
Set xlApp = Nothing

This works almost exactly how I want it to work.

The only thing wrong is that the columns are all the same width and they are all to narrow.

Is there a way to make the columns automatically become the width of the longest text within them (exactly what happens when you double click on the side of a squashed column in excel)?

View 5 Replies View Related

Modules & VBA :: Editing To Force At Least One Space In The Field

Jul 10, 2013

Not = " " And InStr(1,"seat_person"," ") <> 0

I have a field into which I wish to place a person's name and I want to ensure that the field has a space in it but is not a blank field,

so
all blank - illegal
"Bob" - Illegal
"Bob Smith" - legal

the edit at the top is my attempt to code it but it isn't working.

View 13 Replies View Related

Modules & VBA :: Message Box When Editing Existing Record?

Jun 7, 2013

What event would I attach code to, to have a message box pop up warning the user when that he is editing existing records.

I would like the message to appear not as the form loads, or as he tabs to the first control, but right as he makes any changes to the data displayed. Preferably the box should have a "OK" to continue the edit and a "Cancel" to undo it.

View 3 Replies View Related

Modules & VBA :: Editing Existing Record Using Subform

Jan 8, 2015

I'm successful in adding data from the form to the table using VBA. But I couldn't retrieve and edit the data. For retrieving and editing the data I have a different form "[Forms]![Editor]". I have all the fields listed in the image in both the form and table.

1. I want to allow the user to search and retrieve a specific row based on the condition Incident ID and the Package code are same
2. I want the user to edit the fields in the form and update it in the same row again.

View 2 Replies View Related

Modules & VBA :: Trimming White-space After Pulling Data From Excel Cell?

Apr 15, 2014

I've got a piece of VBA scripting which runs as an event linked to a button on my MS Access form.

I maintain a database of members of staff at my organisation. It's pretty outdated...

I'm basically wanting to pull in their updated data (extracted from on our payroll system) from a spreadsheet, into a form, when clicking a button on a particular person's record.

This is what I have so far.

Code:
start = Forms!frm_main2!txt_start_row.Value - 1
conv = DDEInitiate("EXCEL", "Staff List.xlsx")
cell_employee_number = "R" & start & "C1"
cell_surname = "R" & start & "C2"

[Code] ....

The function "CStr(DDERequest())" converts the cell number into the readable data, however I seem to have whitespace below the value.

What would I need to do to strip out this whitespace? Would I use strtrim? If so, I am unsure of the syntax... how would I incorporate strtrim into the above?

View 7 Replies View Related

Modules & VBA :: Open Excel Workbook From Access - Clear Cell Contents

Dec 5, 2013

I would like to open an Excel workbook from MS Access and clear cell contents, or just delete some records in a specific worksheet.

If you open the test workbook, cell contents in RAW need to be deleted by calling from Access.

I have produced some code but it's partially working.

Code:
Sub TestFileOpened()
' Test to see if the file is open.
If IsFileOpen("test.xls") Then
' Display a message stating the file in use.
MsgBox "File already in use!"

[Code] ....

If you put this in a standard module in access, the function works, but the part that doesn't work is where it says "activesheet". It somehow tries to recognize it as a variable, but it's not going to be a variable.

View 3 Replies View Related

Modules & VBA :: Conditional Formatting - Backcolor Determined By Color Value Stored In A Cell

Jul 21, 2015

I would like to know if this is possible using VBA ( or other method)

I want to determine the back color o a cell based on a color value stored in another cell in other word

backcolor of cell A = the value of cell B

So if I change the numbers of cell B (which is color codes) , backcolor of cells A change accordingly and it will have the color specified in cell B.

View 4 Replies View Related

Modules & VBA :: Adding And Editing Records From Unbound Fields

Mar 4, 2015

I total novice at VBA. I am trying to code a button to modify (the last) record in a subform list and then add a new record based on values in unrelated or unbound fields on the button form.

The following code is based on the first of two YouTube tutorials (this bit on the edit) and looks like it should work. Except that my Access 2010 with Visual Basic for Aplication v7 does not recognise the type definition Database or Recordset

Code:
Private Sub ANOwner_Click()
Dim cn As Integer
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb

[Code] .....

View 6 Replies View Related

Modules & VBA :: Editing Data From Database In Textbox Taken From Subform

Jul 11, 2013

In my form I have a subform, which displays A, B, C. Then information C is displayed in textbox. User should have a possibility to modify this data in order to modify data in database.

I am able to display information C in text box based on this subform. However it is uneditable, although property of enabled is yes and locked is no.

It seems to me, that it is impossible to edit data because it is taken not directly from database but from sub form, so I make special query which takes data directly from database however I lose an event which is based on selecting proper record from subform (there is only onEnter and onExit events)

View 5 Replies View Related

Modules & VBA :: Show Lock Status Of A Record When Other User Is Editing Data?

Mar 27, 2015

I have a form and I want show a message on the form when the it is locked as another user is editing the data in a particular record.

I know the record selectors show the records lock status but it a very tiny symbol which will mean nothing to the users of the database and anyway I don't want record selector bar on the form. How I would do this???

View 2 Replies View Related

Add Value To Cell According To Another Cell In Same Record

Nov 21, 2006

i have a table of articles. A field in the table is ArticleSubject

the ArticleID is made up of 3 letters then 3 numbers. i want the 3 letters to be something according to the subject
for example i want the first 3 letters of the ArticleID to be MAT*** (* is a number) if the subject is Maths
or ENG*** if the subject is English

the subject is picked from a listbox in the same record

how would i do this in a table . i am reluctant to use append or update queries.
but will do so if its the only way.

View 4 Replies View Related

Modules & VBA :: Lookup Default Value

Jul 23, 2013

I have a Lookup field that possesses a ID Number and Company name, taken from another table (which the user can add to as required).I would like to set my Lookup field to specific ID Number and Company name by default, as this will be used most frequently by users completing the form.how to refer specifically in VBA to specific table, column and ID number, but have not had much luck.

View 7 Replies View Related







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