-
If Me.NewRecord = True Then
-
-
Me.cmbCNum.Locked = False
-
Me.cmbSNum.Locked = False
-
Me.cmbCNum.Enabled = True
-
Me.cmbSNum.Enabled = True
-
-
If Me.cmbCNum.ControlType = acTextBox Then
-
Me.cmbCNum.SetFocus
-
DoCmd.RunCommand acCmdChangeToComboBox
-
End If
-
If Me.cmbSNum.ControlType = acTextBox Then
-
Me.cmbSNum.SetFocus
-
DoCmd.RunCommand acCmdChangeToComboBox
-
End If
-
-
Else
-
-
If Me.cmbCNum.ControlType = acComboBox Then
-
docmd.openform("frmCSN", acDesign)
-
Me.cmbCNum.ControlType = acTextBox
-
End If
-
If Me.cmbSNum.ControlType = acComboBox Then
-
Me.cmbSNum.SetFocus
-
DoCmd.RunCommand acCmdChangeToTextBox
-
End If
-
-
Me.cmbCNum.Locked = True
-
Me.cmbSNum.Locked = True
-
Me.cmbCNum.Enabled = False
-
Me.cmbSNum.Enabled = False
-
-
End If
-
What I want to do is change the combo box to a text box, and vice versa, depending if the form is on a new record or not. The rest of the code works, but the part for changing the type of box doesn't. It doesn't work if I use, for example, -
If Me.cmbSNum.ControlType = acComboBox Then
-
Me.cmbSNum.ControlType = acTextBox
-
End If
-
either.
Help?
Allow Design Changes is set to all views.
10 12397 -
If Me.NewRecord = True Then
-
-
Me.cmbCNum.Locked = False
-
Me.cmbSNum.Locked = False
-
Me.cmbCNum.Enabled = True
-
Me.cmbSNum.Enabled = True
-
-
If Me.cmbCNum.ControlType = acTextBox Then
-
Me.cmbCNum.SetFocus
-
DoCmd.RunCommand acCmdChangeToComboBox
-
End If
-
If Me.cmbSNum.ControlType = acTextBox Then
-
Me.cmbSNum.SetFocus
-
DoCmd.RunCommand acCmdChangeToComboBox
-
End If
-
-
Else
-
-
If Me.cmbCNum.ControlType = acComboBox Then
-
docmd.openform("frmCSN", acDesign)
-
Me.cmbCNum.ControlType = acTextBox
-
End If
-
If Me.cmbSNum.ControlType = acComboBox Then
-
Me.cmbSNum.SetFocus
-
DoCmd.RunCommand acCmdChangeToTextBox
-
End If
-
-
Me.cmbCNum.Locked = True
-
Me.cmbSNum.Locked = True
-
Me.cmbCNum.Enabled = False
-
Me.cmbSNum.Enabled = False
-
-
End If
-
What I want to do is change the combo box to a text box, and vice versa, depending if the form is on a new record or not. The rest of the code works, but the part for changing the type of box doesn't. It doesn't work if I use, for example, -
If Me.cmbSNum.ControlType = acComboBox Then
-
Me.cmbSNum.ControlType = acTextBox
-
End If
-
either.
Help?
Allow Design Changes is set to all views.
What I want to do is change the combo box to a text box, and vice versa, depending if the form is on a new record or not. The rest of the code works, but the part for changing the type of box doesn't.
The only time you can programmatically change the type of any Control is when you are in Design Mode for the Parent Container.
The only time you can programmatically change the type of any Control is when you are in Design Mode for the Parent Container.
can I do that in code?
edit: by the way that went straight over my head!
Noticed another point;
The first If... in the Else... statement won't work. If that worked would I be able to change it to a text box?
can I do that in code?
edit: by the way that went straight over my head!
]can I do that in code?
I doubt it very much since you would need to be able to determine if you are on a New Record or not. This obviously is not possible if the Form is in Design Mode. I'm sure other Moderators/Expert will look in and give their opinion also.
-
Sub Form_Current()
-
-
Dim rcdCSN As Long
-
-
If Me.NewRecord = True Then
-
If Me.cmbCNum.ControlType = acComboBox Then
-
rcdCSN = Form.CurrentRecord
-
DoCmd.Close acForm, "frmCSN", acSaveYes
-
DoCmd.OpenForm "frmCSN", acDesign
-
Forms!frmCSN!cmbCNum.ControlType = acTextBox
-
DoCmd.Close acForm, frmCSN, acSavePrompt
-
DoCmd.OpenForm "frmCSN"
-
Me.CurrentRecord = rcdCSN
-
End If
-
End If
-
-
End Sub
-
??
But the variable rcdCSN won't set.
-
Sub Form_Current()
-
-
Dim rcdCSN As Long
-
-
If Me.NewRecord = True Then
-
If Me.cmbCNum.ControlType = acComboBox Then
-
rcdCSN = Form.CurrentRecord
-
DoCmd.Close acForm, "frmCSN", acSaveYes
-
DoCmd.OpenForm "frmCSN", acDesign
-
Forms!frmCSN!cmbCNum.ControlType = acTextBox
-
DoCmd.Close acForm, frmCSN, acSavePrompt
-
DoCmd.OpenForm "frmCSN"
-
Me.CurrentRecord = rcdCSN
-
End If
-
End If
-
-
End Sub
-
??
But the variable rcdCSN won't set.
Forget about rcdCSN, it goes out of scope as soon as the 1st Instance of frmCSN is closed since it is Local to the Form's Current() Event. The CurrentRecord Event is Read Only, you can only Read its value, you cannot assign the Current Record of a Form to a value.
pah I gave up, I'll settle with the little arrow being there...
pah I gave up, I'll settle with the little arrow being there...
Never give up - just try a different approach.
I placed a text box over the combo box in the end, and just acitvate them depending on which I want
I placed a text box over the combo box in the end, and just acitvate them depending on which I want
Just what I was talking about - a different approach!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: VINAY |
last post by:
Dear All,
The subject line could be bit confusing. So let me explain in
details, please have patience. I have developed an ActiveX
Control(Combo Box Control) in VB6 for a touch screen...
|
by: MS |
last post by:
What's the best way to "store" and display a value in a text box that
changes from day to day. An example of this would be where the name of the
user is manually typed in after using the datbase,...
|
by: Doug |
last post by:
Hi
I have the following code (not mine) that populates a datagrid with some
file names. But I want to replace the datagrid with a combo box.
private void OnCurrentDataCellChanged(object sender,...
|
by: Arnold |
last post by:
Greetings Gurus,
In a mainform's header, I have a combobox named comboStudents. The
rowsource for this combobox is:
SELECT -999 As StudentID, "<Add New Student>" As FullName, "aaa" As...
|
by: jegadeep |
last post by:
In a JSP page there are one combo box and one text feild.....
Change in one combo box will have hit the database ....
And get values from that , populate the corresponding values in the text...
|
by: vinodkus |
last post by:
dear sir/madam
I have a combo which has 2 values
I want when its value is changed then its value should be display in a
text box.
Thanks In Advance
|
by: jmartmem |
last post by:
Greetings,
I have an Access 2002 continuous form called "Project Update Form" in which users can update project values presented in a series of combo boxes and text boxes. I have three combo boxes...
|
by: pipeme |
last post by:
Hi
I am using Access 2003 and I have a form with 120 textboxes in a grid layout. Depending on a selection made in a combo box, I want to change the visibility of certain textboxes in the grid. ...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
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...
| |