I have a series of comboboxes on a form that are used to display forms
in DS view (theres a qry behind it all). This is working well for me.
Some people like to see the data in DS view, some in normal form view.
I know they have the option to change that, but I trying to make this
as user friendly as possible (and to learn about VBA for myself)
So I thought I'd use two option buttons to identify this choice
........one for Forms view, one for DS view. One set of buttons that
could be used for ALL the comboboxes
In the on change event procedure for the combo boxes (one example
enclosed) can one specify which view to use to show the resultant
form by passing either acFormDS or acNormal to the code from the
option button?
opForm = option button, yes or no (on change turns opDatasheet to
"no", opForm yo "yes")
opDataSheet = option button, yes or no (on change turns opDatasheet
to "yes", opForm to "no")
Current VBA
Private Sub cmbPHP_Change()
DoCmd.OpenForm "frmPHP", acFormDS
DoCmd.Maximize
Me.cmbPHP = ""
End Sub
Proposed VBA (can I do this? it doesn't work, so it seems not, but I
may have the syntax wrong)
Private Sub cmbPHP_Change()
DoCmd.OpenForm "frmPHP", IFF("opForm"="yes", acNormal, acFormMS)
DoCmd.Maximize
Me.cmbPHP = ""
End Sub
Thanks Jerry 10 3288
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Ya threw me w/ "cmbPHP" as a ComboBox designation. ComboBox prefix is
"cbo," and "cmb" is the prefix for a CommandBar.
You should change the event to AfterUpdate instead of OnChange 'cuz
OnChange fires everytime the user types a character into the ComboBox.
AfterUpdate fires when the contents of the ComboBox have changed. Kinda
counterintuitive, but that's how it works.
The IIf() function should be like this:
DoCmd.OpenForm "frmPHP", IIf(Me!opForm=True, acNormal, acFormDS)
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQ9aTkoechKqOuFEgEQJ+/wCgzICT1dOfZq4DlLxTNEPqJI2ATiYAnii9
/gxVKxyPYHLxAw+af5SOZ7WH
=l7nz
-----END PGP SIGNATURE----- je*********@pioneer.com wrote: I have a series of comboboxes on a form that are used to display forms in DS view (theres a qry behind it all). This is working well for me. Some people like to see the data in DS view, some in normal form view. I know they have the option to change that, but I trying to make this as user friendly as possible (and to learn about VBA for myself)
So I thought I'd use two option buttons to identify this choice .......one for Forms view, one for DS view. One set of buttons that could be used for ALL the comboboxes
In the on change event procedure for the combo boxes (one example enclosed) can one specify which view to use to show the resultant form by passing either acFormDS or acNormal to the code from the option button?
opForm = option button, yes or no (on change turns opDatasheet to "no", opForm yo "yes") opDataSheet = option button, yes or no (on change turns opDatasheet to "yes", opForm to "no")
Current VBA Private Sub cmbPHP_Change() DoCmd.OpenForm "frmPHP", acFormDS DoCmd.Maximize Me.cmbPHP = "" End Sub
Proposed VBA (can I do this? it doesn't work, so it seems not, but I may have the syntax wrong) Private Sub cmbPHP_Change() DoCmd.OpenForm "frmPHP", IFF("opForm"="yes", acNormal, acFormMS) DoCmd.Maximize Me.cmbPHP = "" End Sub
Worked like a charm !!
Thanks for the help.
I picked up the use of cmb for combobox from some instructional
materials. I don't have so much code that I can't change that.
Jerry -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Ya threw me w/ "cmbPHP" as a ComboBox designation. ComboBox prefix is "cbo," and "cmb" is the prefix for a CommandBar.
You should change the event to AfterUpdate instead of OnChange 'cuz OnChange fires everytime the user types a character into the ComboBox. AfterUpdate fires when the contents of the ComboBox have changed. Kinda counterintuitive, but that's how it works.
The IIf() function should be like this:
DoCmd.OpenForm "frmPHP", IIf(Me!opForm=True, acNormal, acFormDS)
I have another question.
I'd like the DS to open maximized, but the form to open restored cued
by this same afterupdate event
example
DoCmd.OpenForm "frmPHP", IIf(Me!opForm=True, acNormal, acFormDS)
IIf(Me!opForm=True, Restore, Maximize)
(but obviously these two statments aren't linked in any way, by the
time the IIf statement is reached the form is already opening)
I tried
DoCmd.OpenForm "frmPHP", IIf(Me!opForm=True, acNormal=Restore,
acFormDS = Maximize)
The syntax wasn't flagged, but the form always opened up restored
regardless of the status of opForm
Should this be a case tree, or perhaps nested IIf's? I'm still
pondering this.
Thanks
Jerry DoCmd.OpenForm "frmPHP", IIf(Me!opForm=True, acNormal, acFormDS)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Easiest way is to have the DS form Maximize in it's OnOpen event:
Private Sub Form_Open(Cancel As Integer)
DoCmd.Maximize
End Sub
To restore when the form closes:
Private Sub Form_Close()
DoCmd.Restore
End Sub
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQ9cC0YechKqOuFEgEQKxjwCg/TQyC/9rGTUXinNPO7O9wFxAIEYAoPk9
S6PosVLJQjy3xvUdA53iNGRd
=D3lP
-----END PGP SIGNATURE-----
Jerome Ranch wrote: I have another question. I'd like the DS to open maximized, but the form to open restored cued by this same afterupdate event
example
DoCmd.OpenForm "frmPHP", IIf(Me!opForm=True, acNormal, acFormDS) IIf(Me!opForm=True, Restore, Maximize) (but obviously these two statments aren't linked in any way, by the time the IIf statement is reached the form is already opening)
I tried DoCmd.OpenForm "frmPHP", IIf(Me!opForm=True, acNormal=Restore, acFormDS = Maximize) The syntax wasn't flagged, but the form always opened up restored regardless of the status of opForm
Should this be a case tree, or perhaps nested IIf's? I'm still pondering this.
Thanks Jerry
DoCmd.OpenForm "frmPHP", IIf(Me!opForm=True, acNormal, acFormDS)
Let me digest this
So what you have done here is to specify in a separate VBA statemnent
that when opening ANY Form as acNormal, open it restored; but when
opening any Form as acFormDS, open it maximized?
Thanks
Jerry
On Wed, 25 Jan 2006 04:47:24 GMT, MGFoster <me@privacy.com> wrote: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Easiest way is to have the DS form Maximize in it's OnOpen event:
Private Sub Form_Open(Cancel As Integer) DoCmd.Maximize End Sub
To restore when the form closes:
Private Sub Form_Close() DoCmd.Restore End Sub
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Ah... I see what you want: If the form opens in DS you want it
maximized, but if it opens in Normal mode you don't want it maximized.
If this is correct then you'll have to handle the Maximizing from the
routine that opens the form and not in the target form's OnOpen event.
In the target form leave the OnClose event Restoring the form. In the
source routine do this:
DoCmd.OpenForm "frmPHP", IIf(Me!opForm=True, acNormal, acFormDS)
If Me!opForm = False Then DoCmd.Maximize
The If statement will maximize the form when you want a DS display.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQ9fic4echKqOuFEgEQJvYgCfSFGRnfk8B6ZTrgbqU9JHx9 RLDeUAn2Te
rIRpxjtEtsCdPiaMDKjHVMUr
=r83e
-----END PGP SIGNATURE----- je*********@pioneer.com wrote: Let me digest this
So what you have done here is to specify in a separate VBA statemnent that when opening ANY Form as acNormal, open it restored; but when opening any Form as acFormDS, open it maximized?
Thanks Jerry
On Wed, 25 Jan 2006 04:47:24 GMT, MGFoster <me@privacy.com> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Easiest way is to have the DS form Maximize in it's OnOpen event:
Private Sub Form_Open(Cancel As Integer) DoCmd.Maximize End Sub
To restore when the form closes:
Private Sub Form_Close() DoCmd.Restore End Sub
Yep
Works Great
Thanks for your help
Jerry
On Wed, 25 Jan 2006 20:41:24 GMT, MGFoster <me@privacy.com> wrote: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Ah... I see what you want: If the form opens in DS you want it maximized, but if it opens in Normal mode you don't want it maximized. If this is correct then you'll have to handle the Maximizing from the routine that opens the form and not in the target form's OnOpen event.
In the target form leave the OnClose event Restoring the form. In the source routine do this:
DoCmd.OpenForm "frmPHP", IIf(Me!opForm=True, acNormal, acFormDS)
If Me!opForm = False Then DoCmd.Maximize
The If statement will maximize the form when you want a DS display.
DoCmd.OpenForm "frmPHP", IIf(Me!opForm=True, acNormal, acFormDS)
If Me!opForm = False Then DoCmd.Maximize
Works famously. Got just the behavior I wanted.
So now, if I wanted to make sure that the columns autofit when I open
in DS view, I see some VBA code on the web that uses this line
ActiveSheet.Columns.Autofit
as part of a larger VBA sub.
Can't seem to get it to work, but then, I'm not really displaying a
sheet, I'm displaying a Form in Sheet view. So maybe the syntax is
wrong?
Jerry
On Wed, 25 Jan 2006 20:41:24 GMT, MGFoster <me@privacy.com> wrote: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Ah... I see what you want: If the form opens in DS you want it maximized, but if it opens in Normal mode you don't want it maximized. If this is correct then you'll have to handle the Maximizing from the routine that opens the form and not in the target form's OnOpen event.
In the target form leave the OnClose event Restoring the form. In the source routine do this:
DoCmd.OpenForm "frmPHP", IIf(Me!opForm=True, acNormal, acFormDS)
If Me!opForm = False Then DoCmd.Maximize
The If statement will maximize the form when you want a DS display.
That is the command for an Excel spreadsheet & won't work in Access.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA) je*********@pioneer.com wrote: So now, if I wanted to make sure that the columns autofit when I open in DS view, I see some VBA code on the web that uses this line
ActiveSheet.Columns.Autofit
I see there is a ColumnWidth property in Access, that when set = -2,
autosizes the column to fit the largest item
Looks like I'd have to set each data column individually
Jerry
On Thu, 26 Jan 2006 01:26:52 GMT, MGFoster <me@privacy.com> wrote: That is the command for an Excel spreadsheet & won't work in Access. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Paul |
last post by:
Hi,
How do I on the change event of a list box open a new url in the
current window in which the list box resides. I'm not using frames.
Thanks,
Paul
|
by: BerkshireGuy |
last post by:
I have a optionbox with two options.
Depending on what option the user selects, I have code that populates a
listbox using a select statement.
The code is working fine expect that when the...
|
by: Roger |
last post by:
Is this an easy thing to change?
I want to put an option button on a form and want to dynamically change the
color (Red, Yellow, Green) for
showing a status. I figured it would be an easy task,...
|
by: Learner |
last post by:
Hello,
I converted a VS 2003 project to VS 2005. It works perfectly
alright in VS 2003 but when I try running in VS 2005 I got strange
thing going on. The code (my button click event ) runs...
|
by: Kuldeep |
last post by:
Hello All,
Visual Studio 2005
ASP.NET 2.0
C#.NET 2.0
I have an application which has a Button click event procedure as given
below.
protected void btn_Click(object sender, EventArgs e)
| |
by: AMD_GAMER |
last post by:
Hi,
I am trying to print address labels. I have a form which asks for
the user to input the first name, middle initial, and last name. On
the button click to print the label, I have an event...
|
by: ladycyradis |
last post by:
Hi,
I'm new here and have a bit of a problem. I'm building a form in Access 2003 and have a piece of code I'm using to ensure that the correct values are saved in the table when each option is...
|
by: talk2mishal |
last post by:
Hi,
As i m newbie for the Perl With Html Button.
The scenario is like this:
I have HTML button in the perl Script.
I have to get the Data of Enable checkbox Data using the...
|
by: moepusu |
last post by:
How can I write click command in build event for my form using option button? Here I wrote like that, but when I click option1 it doesn't work. thank you
private Sub Report_Selection_Click()
...
|
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: 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: 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...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |