473,397 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

change field name on a combo box

So i have a few forms that are named similarly:

Maintenence-users
Maintenence-files
Maintenence-printers

i have a combo box that shows these forms and a button that opens up the form i selected.

i do not want the words "Maintenence" to show up in the combo box and i do not want to rename the forms themselves..

any way to keep the original name, but display names in combobox differently?

Thanks!
Jul 26 '11 #1

✓ answered by NeoPa

Your SQL would be :
Expand|Select|Wrap|Line Numbers
  1. SELECT   Mid([Name],13)
  2. FROM     [MSysObjects]
  3. WHERE    (([Name] Like "Maintenence_*")
  4.   AND     ([Type] = -32768))
  5. ORDER BY [Name]
Your Button code would be :
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command3_Click()
  2. On Error GoTo Err_Command3_Click
  3.  
  4.     Dim stDocName As String
  5.     Dim stLinkCriteria As String
  6.  
  7.     Combo1.SetFocus
  8.     stDocName = "Maintenance_" & Combo1.Text
  9.     DoCmd.OpenForm stDocName, , , stLinkCriteria
  10.  
  11. Exit_Command3_Click:
  12.     Exit Sub
  13.  
  14. Err_Command3_Click:
  15.     MsgBox Err.Description
  16.     Resume Exit_Command3_Click
  17.  
  18. End Sub

8 2594
NeoPa
32,556 Expert Mod 16PB
Sure. Strip the "Maintenance-" part from the name when populating the ComboBox and add it in the code that opens the form. Does that make sense?
Jul 26 '11 #2
Rabbit
12,516 Expert Mod 8TB
Or, you could use a two column combo box. One for display purposes, and another that is hidden that is the value.
Jul 26 '11 #3
nico5038
3,080 Expert 2GB
I would probably use a Maintenance Main form and have a tabbed control labelled with the "users", etc.
On each tab a subform can hold the data.

Idea ?

Nic;o)
Jul 26 '11 #4
@NeoPa
how would i do that?

the combo box pulls the systemobjs from this sql
Expand|Select|Wrap|Line Numbers
  1. SELECT MSysObjects.Name
  2. FROM MSysObjects
  3. WHERE (((MSysObjects.Name) Like "*Maintenence*") AND ((MSysObjects.Type)=-32768))
  4. ORDER BY MSysObjects.Name;
the button does this
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command3_Click()
  2. On Error GoTo Err_Command3_Click
  3.  
  4.     Dim stDocName As String
  5.     Dim stLinkCriteria As String
  6.  
  7.     Combo1.SetFocus
  8.     stDocName = Combo1.Text
  9.     DoCmd.OpenForm stDocName, , , stLinkCriteria
  10.  
  11. Exit_Command3_Click:
  12.     Exit Sub
  13.  
  14. Err_Command3_Click:
  15.     MsgBox Err.Description
  16.     Resume Exit_Command3_Click
  17.  
  18. End Sub
see the part with Combo1.SetFocus and stDocName = Combo1.Text?

@Rabbit
that sounds like a plan? can you show me how i can do that based on the previous reply above?

Thanks a bunch!
Jul 26 '11 #5
nvm. still the same one. sorry about that.

@Rabbit: I think i'll try your way. do you have any sample code i can test? thanks
Jul 26 '11 #6
NeoPa
32,556 Expert Mod 16PB
Your SQL would be :
Expand|Select|Wrap|Line Numbers
  1. SELECT   Mid([Name],13)
  2. FROM     [MSysObjects]
  3. WHERE    (([Name] Like "Maintenence_*")
  4.   AND     ([Type] = -32768))
  5. ORDER BY [Name]
Your Button code would be :
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command3_Click()
  2. On Error GoTo Err_Command3_Click
  3.  
  4.     Dim stDocName As String
  5.     Dim stLinkCriteria As String
  6.  
  7.     Combo1.SetFocus
  8.     stDocName = "Maintenance_" & Combo1.Text
  9.     DoCmd.OpenForm stDocName, , , stLinkCriteria
  10.  
  11. Exit_Command3_Click:
  12.     Exit Sub
  13.  
  14. Err_Command3_Click:
  15.     MsgBox Err.Description
  16.     Resume Exit_Command3_Click
  17.  
  18. End Sub
Jul 27 '11 #7
@NeoPa:

Thanks! Worked perfectly :D
Aug 1 '11 #8
NeoPa
32,556 Expert Mod 16PB
Always a pleasure Jeffrey :-)
Aug 1 '11 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Stuart Palmer | last post by:
Hi everyone, I have a form with '/' in some of the field names, when I pass through to the next page the field name comes back as though it's been htmlencoded, so getting the value out of the...
4
by: Wim Roffal | last post by:
Is it possible to use javascript to change the name of a field in a form? Thanks, Wim
2
by: Ray | last post by:
I tried to change the field name in a query using "New Name: ". It did not work at all and just display the caption of the Field Name. Is it possible to change the field name or use a new caption...
5
by: David | last post by:
Hi I seem to be getting nowhere with this. I am opening a form which will be used to input Notes into different fields in a table. My problem is changing the unbound field name to the field name...
11
by: Eych | last post by:
I get a VB error when I try to update a table whose field I change with the following statement: dcUpdate.Dataset.Tables(0).Rows(0)("User Name") = Me.textbox1.Text if I change the field name...
5
by: HS1 | last post by:
Hello I have a datagrid to show data for a database table using "seclect * from tablename" The datagrid works OK. However, I want to change the name of the fields in the database to other...
3
by: Daron | last post by:
Is it possible to use a parameter as the field name, not just a criteria? Snippet of my SQL: SELECT Eval("!!.(0)") AS TestField, AS from qry_main The parameter will hold the name of the...
1
by: bassi.carlo | last post by:
I have an application with many combobox in different forms used for choose a particular length (for example items are "ft" - feet, "in" - inch, "m" - meters, and so on). I don't want to put in...
7
JustJim
by: JustJim | last post by:
Hi If all you can do with ALTER TABLE....ALTER COLUMN is change the datatype/size then how do I change the name of a field? I have several database files spread all over the state and some of...
11
tdw
by: tdw | last post by:
Hi all, I have tried a few different methods to accomplish this, but with no luck. I will post the code for the latest attempt at the end of this post. I work at a land surveying company. This...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
0
jinu1996
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.