Creating 'flashing' Form Controls - Problem With Code

Jul 14, 2006

Hello everybody,
Could anyone out there please help me with a small coding problem that I am experiencing....

I have a calculated control on my startup form called txtCurrentAge on which I have put VB code in the on-timer event of the form which makes the control 'flash on & off' if the persons age is below 18.
code as follows:


Private Sub Form_Timer()
If Me.txtCurrentAge.Value < 18 Then
Me.txtCurrentAge.Visible = Not Me.txtCurrentAge.Visible
Else
Me.txtCurrentAge.Visible = True
End If

End Sub

Everything works fine but when a user inadverently clicked on the control by mistake it caused the following error to be displayed: Runtime error 2165 "you cant hide the control that has the focus". What does this mean and how best could I prevent this from happening again as I cant guarantee that any of my users wont click on it again?? The text box concerned has been made 'visible', has not been 'locked' and is 'enabled'.
'
I find this 'flashing action' to be very useful and would like to keep it on my form....

I have searched on this site and various others but have been unsuccesful....

Any help or guidance would be very much appreciated.
P.S I obtained this code via databasedev.co.uk and adapted it to suit my particular DB.

Best Regards

CarolW

View Replies


ADVERTISEMENT

Creating Form Controls In VBA

Dec 18, 2005

Hi guys,

I would like to create text boxes using VBA code ....the reason is that I need a number of text boxes to be created that is equal to the number of rows that is generated by an SQL query.

Any suggestions?

Tnx!

View 2 Replies View Related

Iritating Flashing On A Form

Oct 7, 2005

Hi guys, has anyone experianced the flickering/flashing of a form when one hovers over labels with the mouse. There is no VB code behind the function. I am so iritated and can not work it out.
Would be greatful for any assistance.



regards,

Steve

View 2 Replies View Related

Creating A Map With Some Controls In It

Jan 28, 2005

I wanna know if it's possible to use an access 2002 form to create some controls(icons) on top of a picture (a map) so that i can click those icons to display some info. The trick part is that those icons positions are generated by x,y coordinates from the db itself. Plus a zooming control wold be a plus...

So what are your opinions on my little project.

Thank you all in advance.

JT

View 1 Replies View Related

Creating Controls On Run Time?

Feb 14, 2005

Is it possible to add a control (textbox, commandbutton) at run time, I know it's possible with VB but is it with VBA?

Thanks.

View 2 Replies View Related

Flashing Switchboard

Sep 8, 2005

I have a minor but irritating problem with a small database I have created. When my main menu loads up it keeps flashing until all the data has been displayed (its looks up the user name and version number from tables and also displays the date). I've traced the source of the problem to the embedded picture (3.9 mb) I have used as the background to the menu form but I really don't want to remove the picture. Is there any way to stop this flashing and keep the background?

View 14 Replies View Related

Flashing Problem

Feb 7, 2007

I have a minor but irritating problem with a small database I have created. When I move my mouse over a form specialy over a form labels, form start to flashing.When I move my mouse over a form fields or anywhere else on form I dont have that kind of problem.
Is there any way to stop this flashing and keep the background calm.
How I could get the "flashing" to stop.

Thanks in advance !!

View 7 Replies View Related

Flashing Text

Sep 19, 2007

I am using Access 2003 professional ans i am wondering if this is possible.

I have a form that displays a Log of events from a database, and what i want is :- if a certain condition is met (something very overdue) I want that entry to flash (red if possible). I'm not bothered if its the Text that flashed or the text box. But I need it to stand out like a sore thumb.

Can this be done, and if so, how?

Thanks in advance

View 2 Replies View Related

DLookUp Flashing Error

Dec 16, 2014

I made a form for a table which contains client questionnaire responses, "Dec4Docs". I wanted to include the names of these clients in the form, just to make everything easier for whoever is doing data entry, but client names are in a different table, "BasicInformation". Both the questionnaire table and the client information table use a common ID number, "WISnum". I found a number of online tutorials which instructed me to use the DLookUp function for what I'm doing.This site here, for example, suggests the following formula:

=DLookup("CustomerID", "Orders", "OrderID = " & Forms![Orders]!OrderID)

Which I adapted to:

=DLookUp("FirstName","BasicInformation","WISnum=" & [Forms]![Dec4DocsForm]![WISnumField])

^This was meant to find FirstName in the BasicInformation table where WISnum is equal to the WisnumField of the Dec4DocsForm form. Instead, all I got was a flashing error message that partially broke the program's GUI. I could not find a solution on Google, so I played around for awhile, bug checking by adding and removing things to the formula, until I finally got a little lucky and figured this out:

=DLookUp("FirstName","BasicInformation","WISnum=" & '[Forms]![Dec4DocsForm]![WISnumField]')

View 1 Replies View Related

Difficulty Creating Code

Apr 8, 2007

I am having difficulty creating code that will compare a date in one table (or query) in the [Expire] field and subtracting two months from the date and automatically placing the newly calculated date into the table (or query) in the [Notify Expiration] second field. For example:

Expire Notify Expiration

01/01/2007 11/01/2006
02/01/2007 12/01/2006
03/01/2007 01/01/2007
04/01/2007 02/01/2007
05/01/2007 03/01/2007
06/01/2007 04/01/2007
07/01/2007 05/01/2007
08/01/2007 06/01/2007
09/01/2007 07/01 2007
10/01/2007 08/01/2007
11/01/2007 09/01/2007
12/01/2007 10/01/2007

Please note that for the month of January and February, the subtraction is minus two for these two months and the subtraction is minus one for the year. All other subsequent months just subtracts two for the months leaving the year intact.
I would appreciate any help that will progmatically accomplish these calculations.

Thanks

Charles Moery
Keypounder2@aol.com

View 4 Replies View Related

Creating An Index Using Code? Any Other Way Besides On The Table?

Feb 17, 2005

I am pullling data from a query using an unbound form and a query that that uses linked tables. I can not edit the index of the tables, so is there a way i can create a new index for sorting data in a form?

View 2 Replies View Related

Modules & VBA :: Creating Msg Box That Runs A Code

May 29, 2014

I have a little problem in creating a msg box that then activate a code. How can I do? I was doing

Private Sub Chiusura_Pratica_Click()
MsgBox "Bla Bla Bla " _
VbMsgBoxStyle.vbYesNo
If Response = vbYes Then
Me.Stato.Value = "A Scadere"
Me.Assegnato_a.Value = ""
Else
MyString = "No"
End If
End Sub

But it doesn't work...

View 3 Replies View Related

Modules & VBA :: Creating A Small Loop To Run Code

Oct 1, 2013

creating a small loop to run code.For each record from AREA with PLANTPROGRAMID = VARIABLE Then...In this example, my table is called Area, my field is called plantprogramid, and my variable is defined earlier in code.

View 5 Replies View Related

General :: How To Make Form Controls Change Size / Position As Form Is Resized

Jul 24, 2013

how to make my form controls change size / position as my form is resized / loaded on a computer with a different resolution. Several of the tutorials out there suggest putting code on the "on resize" property of the form. When I looked at the Northwind database to try to mimic their code however, it looks like they must be doing something different as there is no on resize code under the form properties and I was unable to find the code they do use.

View 4 Replies View Related

Modules & VBA :: Adding Controls To Form And Saving Modified Form

Dec 3, 2013

I am trying to open a form in design mode and add controls, this i have done. I am doing this all in a class, and am having trouble saving the modified form.

I have tried using the following, both produce errors

Code:

DoCmd.Save acForm, "tmpQueryDes"
DoCmd.Close acForm, "tmpQueryDes", acSaveYes

View 3 Replies View Related

Form Controls

May 28, 2005

Hi guys,

please give me some directions.

Recently I designed a form with several controls including both TextBox and Combox. Before I submit data by clicking the button, I use VBA to validate the values of those controls (textbox and combox). If the value is not valid, the system will eject a msgbox and automatically set the focus on that component. In order to tidy the code, I use a GoTo statement, which refers to a group of code to display the message due to the value of parameters

But it seems VBA doesn't recongize the control I set through the parameter.

The code as the following:

private function validation () as boolean

Dim ErrorMessage as string
Dim ErrorComponent as String

......
ErrorMessage="Please select the shop Name"
ErrorComponent="ShopName" // ShopNameis a combox

GoTo ExitFunction
.....

......
ErrorMessage="Please set the start date"
ErrorComponent="StartDate" // StartDate is a Textbox
GoTo ExitFunction
.....



ExitFunction:
msgResult = MsgBox(ErrorMessage, vbOKOnly, "Error Message")
Me(ErrorComponent).SetFocus
validation = False
Exit Function


=============

As I tested for seveal time, I'm sure there is something wrong with
"
msgResult = MsgBox(ErrorMessage, vbOKOnly, "Error Message")
Me(ErrorComponent).SetFocus
"

but how can I fix it?

Many Thanks

View 4 Replies View Related

Form With Two Tab Controls

Aug 29, 2006

I am new to Access and have not used VBA.

I have searched the forum on this, but I can't find an example of this problem.

I have a data entry form with a two-page tab control. One is for company info and the other for contact info. The recordsource is a query based on the two tables. Initially I had the page set up as a rather large form with a subform and decided to convert to the cleaner looking tab control (I used copy and paste to transfer the controls).

This form worked initially, but now I have changed some setting so that it doesn't work anymore: I can enter data properly on the first tab, but not on the second.

I have tried changing the various form properties but I must be missing something obvious. All my tab-less forms work the way I expect them to.

What I don't understand is why one tab works and not the other.

View 14 Replies View Related

Hide Controls On A Form

Feb 27, 2006

How do you hide the canned record scrolling keys on the bottom of a Form? I have placed my own controls and do not need them to confuse the Operator, or cause problems.

View 1 Replies View Related

Trouble With Controls In A Form

May 10, 2006

I created lots of controls on my form, and now i cannot create anymore. I do not know what the problem is... I just get an error message that says:

"MS Office Access cannot create any more controls in your form/report. If you have deleted controls from this form/report in the past, try renaming the form/report and then add more controls to it"

I tried renaming the form already. it didnt work :confused:

I tried to create a new database (i copied all the tables, queries and forms into the new database). it didnt work.


I dont know what else to do... Please help
I would dearly appreciate any help. Thank you in advance :)

View 2 Replies View Related

Form's Controls 'invisible'

Nov 8, 2006

I have few forms that look fine when in Design view, but which appear as plain grey screens when opened in Form view. These were working perfectly (i.e. visible in both views) until about half an hour ago.

The only things I have changed are some of the calculations behind certain fields.

Any thoughts?

View 8 Replies View Related

Troubles With Form Controls

Sep 1, 2005

I have a number of list boxes that dont show up in the VBEditor under the form name.

To be more specific, these controls do not show up in the drop-down list on top of the code window. If I try to assign an event procedure through 'code builder' to these controls, they refer back to a pre-existing module instead of the form under "Access Class Objects".

I have tried repairing and compacting the database to no avail. Can someone guide me? Please ask for more info if you would like some.

Thanks in advance.

View 2 Replies View Related

Autocenter Controls On Form

Jul 28, 2006

Hi,
I have a rather simplistic problem that I can't find a solution to! I have a
form that I want to maximize every time it opens (which I have achieved
through DoCmd.Maximize in the Form_Load event), but I also want that all the
controls in the form, staying positioned relative to each other, center
themselves horizontally on the form once it is resized. Maybe I can set a
property that always makes them stay in the horizontal center, which is also
great. How could I accomplish this?
Thank you!
Kriti

View 3 Replies View Related

Add Controls To A Form Dynamically?

Oct 27, 2006

Hi,

Does anyone know how to add controls to a form, dynamically??

View 6 Replies View Related

Ms Access Form With Tab Controls?

Feb 6, 2015

I m trying to create a form with tab controls but it keeps on disappearing in the form view but showing up in design view. Even when I delete the tab control and drag existing fields onto a blank form it is still not showing up in form view but showing in design view.

View 2 Replies View Related

Listing Controls On Open Form

Apr 15, 2006

Dear Friends

How do I list al the controls on an open form including mutiple subforms

Please advice

View 6 Replies View Related

Copying Controls From FORM To A REPORT?

Jan 9, 2006

Hey all, I am wondering if there is a way to copy and past a control from a FORM to a REPORT? I have an activex control for my digital signatures and for some reason the value is not showing up on my report, I have tryed several different ways and I was wondering if there was a way to copy the activex control and on the open of the report the value what was copyed would appear on the report. can this be done?
I believe that somehow the value is not staying in the field provided and just going directly to the table therefore I cant see it on the report. Is this possible? Thanks in advance

View 10 Replies View Related







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