GUI for access 2002

  • Thread starter Thread starter TED MEDIN
  • Start date Start date
T

TED MEDIN

We have a lot of buttons with visual basic programs behind them. Inputbox is
used for decisions the user must make. Is there some way we can make a gui
for decisions the user must make? We are using assistant.newballoon for some
decisions but that is very limited. Anyone got any ideas? TIA
 
We have a lot of buttons with visual basic programs behind them. Inputbox is
used for decisions the user must make. Is there some way we can make a gui
for decisions the user must make? We are using assistant.newballoon for some
decisions but that is very limited. Anyone got any ideas? TIA

One very common way is to use an unbound Access Form with textboxes,
combo boxes, etc. into which the user can enter values. Your code can
then refer to [Forms]![MyFormName]![ControlName] to retrieve the
user's input. I've found this to be much simpler (both for me and for
the user) than using the InputBox function.

John W. Vinson[MVP]
 
What do you use for a trigger to know when to read the form from vba? TIA

John Vinson said:
We have a lot of buttons with visual basic programs behind them. Inputbox
is
used for decisions the user must make. Is there some way we can make a gui
for decisions the user must make? We are using assistant.newballoon for
some
decisions but that is very limited. Anyone got any ideas? TIA

One very common way is to use an unbound Access Form with textboxes,
combo boxes, etc. into which the user can enter values. Your code can
then refer to [Forms]![MyFormName]![ControlName] to retrieve the
user's input. I've found this to be much simpler (both for me and for
the user) than using the InputBox function.

John W. Vinson[MVP]
 
I'd have a command button (or some other appropriate event) on the
Form itself to launch the report, or the code, or whatever action you
want. That is, rather than the code calling the form, you have the
form calling the code.

It that isn't suitable for your needs, you can open a Dialog form from
your code, and have a command button on the form to set its Visible
property to false. This will resume the code, at which time you can
retrieve the value from the form and then close the form.
What do you use for a trigger to know when to read the form from vba? TIA

John Vinson said:
We have a lot of buttons with visual basic programs behind them. Inputbox
is
used for decisions the user must make. Is there some way we can make a gui
for decisions the user must make? We are using assistant.newballoon for
some
decisions but that is very limited. Anyone got any ideas? TIA

One very common way is to use an unbound Access Form with textboxes,
combo boxes, etc. into which the user can enter values. Your code can
then refer to [Forms]![MyFormName]![ControlName] to retrieve the
user's input. I've found this to be much simpler (both for me and for
the user) than using the InputBox function.

John W. Vinson[MVP]


John W. Vinson[MVP]
 
Dialog form would fit what we are currently doing. However, I have no idea
how to open a dialog form.

This is what the vba code looks like:

docmd.openform formname,,,stlinkcritera ' have no idea what
stlinkcritera does
while isformopen(formname) then
strtmp=[form]![formname]![text0] & ""
....
doevents
wend

I entered data in the form & then xed it off.
caught some of the assignments between the while & doevents

Spent a lot of time with help trying to find dialog form info. Nothing :-(
Help. TIA

John Vinson said:
I'd have a command button (or some other appropriate event) on the
Form itself to launch the report, or the code, or whatever action you
want. That is, rather than the code calling the form, you have the
form calling the code.

It that isn't suitable for your needs, you can open a Dialog form from
your code, and have a command button on the form to set its Visible
property to false. This will resume the code, at which time you can
retrieve the value from the form and then close the form.
What do you use for a trigger to know when to read the form from vba? TIA

John Vinson said:
We have a lot of buttons with visual basic programs behind them.
Inputbox
is
used for decisions the user must make. Is there some way we can make a
gui
for decisions the user must make? We are using assistant.newballoon for
some
decisions but that is very limited. Anyone got any ideas? TIA

One very common way is to use an unbound Access Form with textboxes,
combo boxes, etc. into which the user can enter values. Your code can
then refer to [Forms]![MyFormName]![ControlName] to retrieve the
user's input. I've found this to be much simpler (both for me and for
the user) than using the InputBox function.

John W. Vinson[MVP]


John W. Vinson[MVP]
 
Dialog form would fit what we are currently doing. However, I have no idea
how to open a dialog form.

This is what the vba code looks like:

docmd.openform formname,,,stlinkcritera ' have no idea what
stlinkcritera does
while isformopen(formname) then
strtmp=[form]![formname]![text0] & ""
...
doevents
wend

stLinkCriteria is an optional argument which specifies which records
are displayed on the Form. If it's blank you'll see the entire
Recordsource of the form; if it's a valid SQL WHERE clause (without
the word WHERE) you'll see just the records which match that
criterion.

If you use

DoCmd.OpenForm formname, WindowMode:=acDialog

it will open the form in dialog view. The execution of your code will
STOP - no additional lines will be executed until either the form is
closed or is made invisible. There's no need for the While...Wend
loop.

You might want to look at the VBA Help file for the OpenForm method;
there are a number of optional arguments which you may find useful.

John W. Vinson[MVP]
 
Ok got it mostly working :-(.

1.I execute a command button that loads the form with data from a members
data.
2.Then cmd.openform formname,windowmode:=acdialog
3.Operator would make any changes to the data needed.
4.Execute a command button that ....visible=false
5.That turns the code loose to change any data in the members data as you
said

However that only works the 2nd time around :-(

So I tried cmd.openform formname ...
before loading the form with members data 1. above with a bunch of options
but no banana
With this then 2. above doesn't stop anymore

So what can I do to load the form with data before the acdialog command? TIA

John Vinson said:
Dialog form would fit what we are currently doing. However, I have no idea
how to open a dialog form.

This is what the vba code looks like:

docmd.openform formname,,,stlinkcritera ' have no idea what
stlinkcritera does
while isformopen(formname) then
strtmp=[form]![formname]![text0] & ""
...
doevents
wend

stLinkCriteria is an optional argument which specifies which records
are displayed on the Form. If it's blank you'll see the entire
Recordsource of the form; if it's a valid SQL WHERE clause (without
the word WHERE) you'll see just the records which match that
criterion.

If you use

DoCmd.OpenForm formname, WindowMode:=acDialog

it will open the form in dialog view. The execution of your code will
STOP - no additional lines will be executed until either the form is
closed or is made invisible. There's no need for the While...Wend
loop.

You might want to look at the VBA Help file for the OpenForm method;
there are a number of optional arguments which you may find useful.

John W. Vinson[MVP]
 
Ok got it mostly working :-(.

1.I execute a command button that loads the form with data from a members
data.
2.Then cmd.openform formname,windowmode:=acdialog
3.Operator would make any changes to the data needed.
4.Execute a command button that ....visible=false
5.That turns the code loose to change any data in the members data as you
said

However that only works the 2nd time around :-(

So I tried cmd.openform formname ...
before loading the form with members data 1. above with a bunch of options
but no banana
With this then 2. above doesn't stop anymore

So what can I do to load the form with data before the acdialog command? TIA

You have me really confused here.

acDialog is NOT a command. It's an optional parameter specifying the
window mode in which the form will be opened.

And you don't "load a form with data" - a form is just a window ONTO
data. You can use the (again, optional) WhereCondition argument to
Openform (again, read the help file for details) to control which
record or records are visible in that window when the form opens.

I have NO trace of a notion what you mean by "2nd time around".

Could you a) post your code and b) describe what happens when the form
runs? maybe also what it's not doing that you'ld like it to do?
Remember, we can't see your screen!

John W. Vinson[MVP]
 
It seemed so clear to me :-). Sorry here are some pertinent parts of the
code:

with rstmembers
....
'DoCmd.Openform "change members", acPreview, , , acFormPropertySettings,
acWindowNormal

' DoCmd.Openform "change members"

' Forms![change members].Visible = False

Forms![change members]![MEM#] = ![MEM#]

DoCmd.Openform "Change members", , , windowmode:=acDialog ' wait for
the ok



.Edit

![MEM#] = Forms![change members]![MEM#] & ""

.Update

GoTo Agn


....
end with

If I execute as shown above the loading of the form 'change members' fails:
Forms![change members]![MEM#] = ![MEM#]

Because the form is not open.



Notice the 'goto agn' which starts the code again after some preliminaries
establishing the member.

Now that's the 2nd time thru. The form is open & the loading of the form
succeeds.



Notice the first 3 lines are commented out. I spent some time tiring
different methods of opening the form but no banana. HELP
 
It seemed so clear to me :-). Sorry here are some pertinent parts of the
code:

with rstmembers

ok... you're not *looping* through the recordset, at least not here,
just referencing the first record in it. Is it a one-record recordset,
or are you intentionally doing this?
...
'DoCmd.Openform "change members", acPreview, , , acFormPropertySettings,
acWindowNormal

' DoCmd.Openform "change members"

' Forms![change members].Visible = False

The above lines are all commented so they do nothing (in particular
the form named "change members" is not opened, at least not here...
but...
Forms![change members]![MEM#] = ![MEM#]

you're setting the value of a Control on that form to the value of a
field in the recordset, which will simply overwrite the value of MEM#
in the current record.
DoCmd.Openform "Change members", , , windowmode:=acDialog ' wait for
the ok

and now you open the form... without any criteria or wherecondition or
filter...
.Edit

![MEM#] = Forms![change members]![MEM#] & ""

.Update

GoTo Agn


...
end with

If I execute as shown above the loading of the form 'change members' fails:
Forms![change members]![MEM#] = ![MEM#]

Because the form is not open.

Exactly. Because you haven't opened the form. You have a statement
that WOULD open the form but it's commented out; then on the *next*
line you open the form.
Notice the 'goto agn' which starts the code again after some preliminaries
establishing the member.

Now that's the 2nd time thru. The form is open & the loading of the form
succeeds.



Notice the first 3 lines are commented out. I spent some time tiring
different methods of opening the form but no banana. HELP

I'm just as perplexed as you are. It's not at all clear what you're
trying to accomplish, and I'm too tired (it's after midnight here) to
go back over the thread and try to figure it out; I'll try again
tomorrow.

John W. Vinson[MVP]
 
John Vinson said:
ok... you're not *looping* through the recordset, at least not here,
just referencing the first record in it. Is it a one-record recordset,
or are you intentionally doing this?

In this area the opoerator gets to specify the member with his number
address ...
...
'DoCmd.Openform "change members", acPreview, , , acFormPropertySettings,
acWindowNormal

' DoCmd.Openform "change members"

' Forms![change members].Visible = False

The above lines are all commented so they do nothing (in particular
the form named "change members" is not opened, at least not here...
but...
Forms![change members]![MEM#] = ![MEM#]

you're setting the value of a Control on that form to the value of a
field in the recordset, which will simply overwrite the value of MEM#
in the current record.

Thats the point of the form. The members number address ... is displayed.
Operator makes changes to the boxes with number address ...
and then when the ok button is pushed those numbers address ... are changed
in the record set.
and now you open the form... without any criteria or wherecondition or
filter...

But i have the correct record in the dataset poised for change & update
.Edit

![MEM#] = Forms![change members]![MEM#] & ""

.Update

GoTo Agn


...
end with

If I execute as shown above the loading of the form 'change members'
fails:
Forms![change members]![MEM#] = ![MEM#]

Because the form is not open.

Exactly. Because you haven't opened the form. You have a statement
that WOULD open the form but it's commented out; then on the *next*
line you open the form.

Exactly my problem the commented instructions were attemps to get the file
open so we could load the text boxes with the current member info. However,
never was able.
 
Exactly my problem the commented instructions were attemps to get the file
open so we could load the text boxes with the current member info. However,
never was able.

How about:

DoCmd.OpenForm "formname", WhereCondition := "[MEM#] = " & Me.[MEM#]


John W. Vinson[MVP]
 
Ok got to thinking about our problem last nite & it dawned on me to let the
'where' load the form, now things are working. Thanks

John Vinson said:
Exactly my problem the commented instructions were attemps to get the file
open so we could load the text boxes with the current member info.
However,
never was able.

How about:

DoCmd.OpenForm "formname", WhereCondition := "[MEM#] = " & Me.[MEM#]


John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top