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 Replies


ADVERTISEMENT

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 4 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

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

Enable/disable All Controls On Form

Jan 10, 2008

Hello. I have a form with a million little buttons on it (don't get me started, I didn't design it! - heh)...

Depending upon which user is running the mdb, I would like all but 16 (of the 80 or so) objects/controls disabled/enabled. I would like to autodisable all the controls, then enable the subset (or all of them) depending who the current user is.

SO in short, other than individually disabling/enabling the many items, is there a magic command for vba, similar to enable *.* for controls [silly e.g., but I hope you get my point...]

Thoughts!

Thanks!
-madEG

View 2 Replies View Related

Enable Tab Controls On Form Open

Apr 20, 2005

I want to disable a tab control page when a form is open, and enable some of the fields if a check box is checked, and some others if another check box is enabled

Can anyone help.

Paul R

View 5 Replies View Related

How To Clear The Content Of Controls In The Form

Jun 12, 2005

I designed a Data Entry interface. I wish the system can automatically clear all the values of controls in the form after users click the 'save' button.

Is there any good solution instead of manually setting each control's value to null?

I tried Undo method, but it didn't work on either control (textbox) or form itself.


Many Thanks

View 2 Replies View Related

Continuous Form W/ Calculated Controls

Jun 18, 2005

I am creating a continuous form where each record has a couple calculated controls. The problem is, as you scroll down through the records, the computer hasn't performed the calculations yet. It only starts to perform them once they are visible on the screen. So the result is blank fields for about 1 or 2 seconds every time you use the vertical scrollbar until they all get populated. Is there any way to get access to populate all the calculated text boxes when it is loaded, like a report is? I have played around with not using a continous form but rather creating a form with MANY text boxes on it that are filled with a loop. It works and all calculations are performed prior to displaying it on screen its just tricky to work with in a realistic situation and I figured their must be a better way.

Thanks for your help!

View 1 Replies View Related

Independant Selector Controls Per Sub-form Row

Jul 12, 2005

I'm new to Access so apologies in advance if this occurs as simple-headed...

Given a group identifier (e.g. department) I want to display a list of members (e.g. employees) in that group. So I use a sub-form in datasheet view.

Now I want to associate an independant checkbox with each row so that I can identify partiuclar members for some action (e.g. assign to a project).

Thus, I need to set up the checkboxes on each rsub-form ow and then be able to probe them later and get their state and any other info on the row (e.g. key(s) for the individual members).

All help / advice / references welcome!

View 1 Replies View Related

Disabling ALL Controls On A Form Via A Combo Box

Aug 10, 2005

My database has a form with a combo box where the user can select whether the record displayed is "Current", "Sold", or "Withdrawn". I would like to set up the form so that when the user selects "Sold" or "Withdrawn" from the combo box, all other controls on the form are locked and disabled (ie. can't be changed).

What's the best way to do this?

View 4 Replies View Related

Have Controls Null When Form Opens

Dec 14, 2005

What is the best way to have all controls in a subform empty when form opens? The form and subform are bound.


The following:

Private Sub Form_Open(Cancel As Integer)
Me.textDate = Null
End Sub

Produced error - "cant assign a value to object"

thanks in advance

View 6 Replies View Related

Form Controls Disappeared After Export

Jul 13, 2006

Hope someone can shed some light on this.

I have imported the contents of my database into a new database, as all the testing is completed and want a clean start without any dummy data in it or anything. My main form which is where most of the interaction with the database goes on appears blank with no controls on it on form view. In design view, I can see everything (buttons, search fields, subforms etc) but turn into form view, it's blank (except the header). Does anyone know why this happened?

View 4 Replies View Related

Locking Individual Controls On A Form

Oct 12, 2006

Hi

I want to set the On Click Event of a button to unlock the current control a user is on. I know the code to set the property of a named control, but I don't want a button for every control I want to unlock. Is there a 'Me' option for controls?

Regards

David:)

View 2 Replies View Related







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