Hi. I am trying to do something that I'm not actually sure is possible. I am attempting to take a combo box [c_box1] and somehow have it produce textboxes. Further explanation, [c_box1] contains numbers 1-5. When a user clicks on a number within that combobox, I want the result to be that the coordinating number of textboxes will br produced under another field. I have not yet produced the combobox, so perhaps that's why this is so confusing. Allow me to go more into detail.
Positions will be the field that the combobox [c_box1] is contained within. If a user clicks the number "4" in that field, I want it to produce four textboxes under the "Line #" field.
Is this possible???
9 2971
Hi. I am trying to do something that I'm not actually sure is possible. I am attempting to take a combo box [c_box1] and somehow have it produce textboxes. Further explanation, [c_box1] contains numbers 1-5. When a user clicks on a number within that combobox, I want the result to be that the coordinating number of textboxes will br produced under another field. I have not yet produced the combobox, so perhaps that's why this is so confusing. Allow me to go more into detail.
Positions will be the field that the combobox [c_box1] is contained within. If a user clicks the number "4" in that field, I want it to produce four textboxes under the "Line #" field.
Is this possible???
It would seem like it would be possible to do this using the CreateControl command in VBA along with using your combo box output to dictate the number of repeats. However, the CreateControl command requires that the form is in design view, so I'm not sure you could do this in RunTime. You can also use the CreateControl command to create Text Boxes on a new form, so maybe you could some how modify your process to do something like this.
Just a couple of thoughts.
Brad.
How about creating the maximum number of textboxes, set their visibilty as No by Default, and then, in the AfterUpdate event of the combobox, make the appropriate number of boxes visible?
Then, in the Form Current event, makes the text boxes visible if they contain data.
Linq ;)>
How about creating the maximum number of textboxes, set their visibilty as No by Default, and then, in the AfterUpdate event of the combobox, make the appropriate number of boxes visible?
Then, in the Form Current event, makes the text boxes visible if they contain data.
Linq ;)>
I'm new to this so please be patient. :) If this is a new database that I am making, would the "Form Current" event you spoke of be visible to those who will later be using this form on this particular database? I don't want them to be able to change anything to do with the database itself, only with the records and information contained in those records.
Sorry if that's a dumb question. :)
Thanks for the responses *that's to both of you!!!*
We understand that everyone has to start somewhere, but you're really talking about the very basic ABCs of Access/VBA programming here. If you're really going to do this, you'll need to get a decent primer on MS Access (by preference, one for your particular version) that includes at least the very basics of writing code, i.e. how to access the code window, etc. We're happy to answer questions here, that's what we do, but this is not a suitable forum for teaching Access to someone from the ground up.
The Form_Current() event (which you may also see referred to as the On Current event) resides in the Code Module for a form, and shouldn't be available to the end users. It will always look similar to this Private Sub Form_Current()
'Your code goes here
End Sub
The code in this sub fires whenever a record is loaded. When the form itself loads (because the first record is loaded) and anytime you move from one record to another. Because of this, you place code here that you want executed each time a new record is accessed. One example of this would be code to make your textboxes visible, but only if they contain data.
If you have, for example, three textboxes that may or may not need to be displayed, depending on whether they contain data or not, you'd do something like this: -
Private Sub Form_Current()
-
-
If IsNull(TextBox1) Then
-
TextBox1.Visible = False
-
Else
-
TextBox1.Visible = True
-
End If
-
-
If IsNull(TextBox2) Then
-
TextBox2.Visible = False
-
Else
-
TextBox2.Visible = True
-
End If
-
-
If IsNull(TextBox3) Then
-
TextBox3.Visible = False
-
Else
-
TextBox3.Visible = True
-
End If
-
-
End Sub
If IsNull(TextBox1) asks if the box named TextBox1 IsNull (is empty)
If it is null, or empty, it's not displayed TextBox1.Visible = False Else (if it's not null, it has data) it is displayed TextBox1.Visible = True
BTW, the line numbersyou see in the code above are for display purposes here in the forum, and should not appear in the actual code.
Linq ;0)>
We understand that everyone has to start somewhere, but you're really talking about the very basic ABCs of Access/VBA programming here. If you're really going to do this, you'll need to get a decent primer on MS Access (by preference, one for your particular version) that includes at least the very basics of writing code, i.e. how to access the code window, etc. We're happy to answer questions here, that's what we do, but this is not a suitable forum for teaching Access to someone from the ground up.
The Form_Current() event (which you may also see referred to as the On Current event) resides in the Code Module for a form, and shouldn't be available to the end users. It will always look similar to this Private Sub Form_Current()
'Your code goes here
End Sub
The code in this sub fires whenever a record is loaded. When the form itself loads (because the first record is loaded) and anytime you move from one record to another. Because of this, you place code here that you want executed each time a new record is accessed. One example of this would be code to make your textboxes visible, but only if they contain data.
If you have, for example, three textboxes that may or may not need to be displayed, depending on whether they contain data or not, you'd do something like this: -
Private Sub Form_Current()
-
-
If IsNull(TextBox1) Then
-
TextBox1.Visible = False
-
Else
-
TextBox1.Visible = True
-
End If
-
-
If IsNull(TextBox2) Then
-
TextBox2.Visible = False
-
Else
-
TextBox2.Visible = True
-
End If
-
-
If IsNull(TextBox3) Then
-
TextBox3.Visible = False
-
Else
-
TextBox3.Visible = True
-
End If
-
-
End Sub
If IsNull(TextBox1) asks if the box named TextBox1 IsNull (is empty)
If it is null, or empty, it's not displayed TextBox1.Visible = False Else (if it's not null, it has data) it is displayed TextBox1.Visible = True
BTW, the line numbersyou see in the code above are for display purposes here in the forum, and should not appear in the actual code.
Linq ;0)>
Many thanks for your reply Linq as well as my sincerest apologies that you feel I'm entirely learning Access via the advice given on this forum. I have worked in Access, and am familiar with some things, others are foreign to me. I can clearly see why you thought me a total novice based on the answer you gave me. You gave examples and code for simply displaying textboxes, which was not what I was wanting. In fact, given the examples I provided and the correspondence elsewhere in this post, you'll easily find I was asking how to provide blank textboxes in correlation with a combo box. I was aware of the codes you provided and their meanings, just not exactly how to tailor it to my needs.
I appreciate the help/guidance other users on this forum have offered, and hope the little guidance I have offered to others was beneficial. That being said, I would never feel comfortable seeking voluntarily offered advice where it is clearly not offered to "novices" such as myself. Thank you for your time. Have a great day. :)
I'm new to this so please be patient. :) If this is a new database that I am making, would the "Form Current" event you spoke of be visible to those who will later be using this form on this particular database? I don't want them to be able to change anything to do with the database itself, only with the records and information contained in those records.
Sorry if that's a dumb question. :)
Thanks for the responses *that's to both of you!!!*
deanndra
missinglinq was not trying to insult you but trying to be helpful. Being familiar with Access structures and understanding VBA (which is what the Forms On Current event is about) are two different things. Putting code in the On Current event of the form or any other event is standard VBA coding. You spoke of that being "available" to the user. This led missinglinq to understand that you weren't familiar with VBA event coding.
Hiding the structure of the database which would include code from the user requires you to create an mde file. If you want help with that we are happy to provide it.
Again as I say missinglinq was not trying to insult you. Many Access users are unfamiliar with VBA. However, it is an integral part of creating a modern user friendly Access database. Getting a good Access/VBA book is a great place to start learning this stuff.
Mary
Hi. I am trying to do something that I'm not actually sure is possible. I am attempting to take a combo box [c_box1] and somehow have it produce textboxes. Further explanation, [c_box1] contains numbers 1-5. When a user clicks on a number within that combobox, I want the result to be that the coordinating number of textboxes will br produced under another field. I have not yet produced the combobox, so perhaps that's why this is so confusing. Allow me to go more into detail.
Positions will be the field that the combobox [c_box1] is contained within. If a user clicks the number "4" in that field, I want it to produce four textboxes under the "Line #" field.
Is this possible???
I'm still working on this. So far, I have a combo box named CBPos bound to tbl_PositionsAir, and 10 textboxes bound to separate fields within tbl_ParaAir. I have placed the following code in VBA for CBPos: - Private Sub CBPos_AfterUpdate()
-
If IsNull(Me.CBPos) Then
-
Me!Para1.Visible = False
-
Me!Para2.Visible = False
-
Me!Para3.Visible = False
-
Me!Para4.Visible = False
-
Me!Para5.Visible = False
-
Me!Para6.Visible = False
-
Me!Para7.Visible = False
-
Me!Para8.Visible = False
-
Me!Para9.Visible = False
-
Me!Para10.Visible = False
-
Else
-
Me.CBPos = "1"
-
Me!Para1.Visible = True
-
Me!Para2.Visible = False
-
Me!Para3.Visible = False
-
Me!Para4.Visible = False
-
Me!Para5.Visible = False
-
Me!Para6.Visible = False
-
Me!Para7.Visible = False
-
Me!Para8.Visible = False
-
Me!Para9.Visible = False
-
Me!Para10.Visible = False
-
End If
-
End Sub
Now my understanding was that this would be quite tedious having to enter all that for each Pos possibility (values 1-10), but I decided in the end it would probably be easier. However, now the problem I am having is not with hiding the textboxes...all textboxes (Para1-10) are set to invisible. And the numbers 1-10 do appear in CBPos as they should. However, if I go to click on "1" in CBPos, first of all it won't even let me click on it. The cursor simply highlights it and does nothing, so obviously this will not allow any textboxes to appear. And I can't for the life of me understand this. I have changed the code in the AfterUpdate procedure a dozen times...to no avail. I did see something online abotu a Tag property, as well as something for a Function, and wondered if perhaps I wasn't setting this up all wrong. Clueless. Any ideas on what I've coded wrong?
Ooops, I forgot to put in my last reply that the following code is also located with the other code in CBPos: - Private Sub Form_Current()
-
Me!Para1.Visible = False
-
Me!Para2.Visible = False
-
Me!Para3.Visible = False
-
Me!Para4.Visible = False
-
Me!Para5.Visible = False
-
Me!Para6.Visible = False
-
Me!Para7.Visible = False
-
Me!Para8.Visible = False
-
Me!Para9.Visible = False
-
Me!Para10.Visible = False
-
End Sub
NeoPa 32,556
Expert Mod 16PB
If you leave your OnOpen code as it is, you may find the following code a less tedious replacement for the AfterUpdate event. - Private Sub CBPos_AfterUpdate()
-
Dim intX As Integer
-
-
For intX = 1 To 10
-
Me.Controls("Para" & intX).Visible = (CBPos >= intX)
-
Next intX
-
End Sub
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Bill K |
last post by:
Does the vb.net combo box control have the auto complete/expand feature like
the Access combo box - where you begin typing in the conbo box and the first
possible
choice appears?
If so, how do...
|
by: sao |
last post by:
I am currently using Access 2000.
In my table it is the following fields that are set up:
1 - Staff Name
2 - Department
This table is already populated with 100+ records (staff along with...
|
by: Dwight |
last post by:
Help !
Have a combo box in accsess, with 6 fields, I want each to show up a
different colour when they ar selected/viewed. I have tried the
following code but seems to have no affect can anyone...
|
by: Jim Devenish |
last post by:
I have a combo box with Auto Expand and Limit to List both set to
'yes'.
When I type 'C' I correctly get:
C J Valeting
When I type 'CO' I get:
Cogent Seating Ltd
again correct
BUT when I go...
|
by: VenuGopal |
last post by:
hi,
i have implemented a MultiColumn Combo by overriding thr Combo Box's
DropDown Event. In the Event i have populated a DataTable to contain the
Necessary MultiColumns.
Now i need to implement...
|
by: Gautam Dasaka |
last post by:
Hi,
I am creating an Access database form to store invoice information in the same file. This is a single user file, but tested on a few workstations..
I am using a combo box (CboSupplier_List)...
|
by: pemigh |
last post by:
In a prior posting (too old to reply directly), Jim Devenish described
exactly what my client has seen, both in terms of AutoExpand behaving
oddly and the way that caps lock relates to the...
|
by: John |
last post by:
AC2007
I changed my combo's row source and then the autocomplete stopped
working. The combo is two columns, bound to the first.
First column is primary key (ID). Second column is a...
|
by: scolivas |
last post by:
I think this is a me thing. but can't remember how to do it.
I have a form that I am using and would like for a txt box to automatically populate based on what is selected in a combo box.
here...
|
by: mahesh123 |
last post by:
Hi Folks,
I want Help regarding the Auto search in the Combo Box. When I am pressing the characters it will move to the appropraite words in the Combo Box.
For Example if the Combo Box filled...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |