Help Needed

B

BigGuyKen

I have an Access table that I want to select certain information from and run
a report. Using Visual Basic I have set up a form that the user can select 2
different fields on. The 2 fields are drawing number and work order number.
When the form displays, I want the values in the selection boxes to be the
current drawing and the current workorder that the user is looking at in
AutoCad. I have figured out that by using the "On Load" of the form that I
can get those values to be the displayed value. When I run the report, it is
correct. If I turn around and run the report again, there is an additional
record on the report. It happens to be the first record in the Access table.
Apparently by using the "On Load" property, it chages and saves the values
to the first record in the table.

How do I get these values to not save? I am extremely new to this type of
programming and any help would be greatly appreciated.

Thanks for any and all help I may receive.
Ken.
 
T

Ted Allen

Hi Ken,

First, a disclaimer. Your post said that you are creating the form in
Visual Basic, but I am assuming that you meant the form was created in Access
and you have created some code in Visual Basic for Applications. If that is
incorrect, the following may not apply, although the resolution may still be
similar.

It sounds like your form controls are likely bound to the table fields, and
the OnLoad event is changing their values for the current (first) record.

If you are only using the controls to generate reports, and don't need to
use them to change existing data in the table, you can probably correct the
problem that you are encountering by unbinding the controls. To do this, all
you would have to do is go to the control properties and delete the entry for
the "Control Source" property.

If you want to use the form to make edits as well as generate the reports,
so you want the controls to be bound, you would probably want to revise the
code to navigate to the proper record in the form, rather than changing the
control values for the current record.

If that is the case, Access has a wizard for new combo boxes that will
generate code for you to navigate to a record. You can probably adapt that
code to your situation pretty easily. The general process is to set a
recordset = to Me.Recordsetclone, then use FindFirst on that recordset.
Then, you check the recordset.NoMatch property to see if a match was found,
and if so you set the form bookmark equal to the recordset bookmark.

Post back if my assumptions were incorrect, or if you would like more detail
on any of the above.

HTH, Ted Allen
 
B

BigGuyKen

It works somewhat. I am using a select distinct to fill the values that the
user can select for each field. In front of each field is a combo box that
has options of "All Drawings or One Drawing" and "All Work Orders or One Work
Order". I can now not change what is selected in the combo box. At least
you were right, it does not change the value of those fields in the first
record.

Any new suggestions? Thanks....
 
T

Ted Allen

Hi Ken,

You may want to check the following:

Did you unbind the form? (delete the entry for the recordsource). This
shouldn't cause the problem that you are encountering, but there is no need
for it to be bound and it will open faster as unbound.

For the combo's, are they still bound to a column? Even though the control
source was deleted, they should still be bound to a column from the row
source (the row source is what provides the selection choices, the bound
column determines the value that will be assigned to the control when a
selection is made, and if a control source has been specified then that value
would be assigned to that underlying field in the table in addition to the
control)

If those all look ok, check the enabled and locked properties. enabled
should be set to yes, and locked to no.

Those are the only things that I can think of off of the top of my head.
I've never encountered unbound controls that would not let me change the
values. Usually, you would only see that if they are locked or disabled.

Hopefully you'll be able to figure the problem out. Once you do, you may
also want to experiment with using list boxes rather than combos if you think
it would be helpful to allow users to select multiple work orders or
drawings. I often do this, and then I use VBA to construct a list of the
ID's that were selected by the user, and add those to the WHERE conditions
using IN() in conjunction with the constructed list.

HTH, Ted Allen

BigGuyKen said:
Yes this is an Access form, and this form is being used to gather criteria to
be used in the SQL Query. I have my "All Drawings and One Drawing" in an
"Option Group" and the values the user can select are in a "ComboBox" beside
it. By removing the 'Control Source' property, I can no longer change the
Option Group or select a different value from the ComboBox list, which is
loaded by the Select Distinct for the field from the table.

If you need anything further, let me know.
Thanks..

Ted Allen said:
I'm not sure I completely follow, I'll ask a few more questions if you don't
mind.

Is this an Access form?

What is the main purpose of the form? Are you gathering criteria to be used
to construct the sql for the report data source?

If so, it sounds like this is kind of a query by form setup. If this is the
case, many would usually do something similar to the following:

create an unbound form (no form record source, no control control sources)

create checkboxes, combo boxes, etc to allow the user to specify criteria.
For the combo boxes, set the rowsource type and rowsource as applicable. (by
the way, in your case, you may want to consider checkboxes for the "Include
All WO's" and "Include all Drawings" options.

create a query that references the form control values as necessary to
return the desired records (using Forms![YourFormName]![YourControlName])

create a report that uses the query as it's record source.

Alternatively, for more complex queries, we would usually use VBA to just
construct the query sql and use that for the report's query.

Offhand, I can't think of why Access will not let you change the values in
unbound combo boxes, I haven't encountered that before. But, hopefully
something above will give you an idea. If not, post back with a little more
detail as to the process that you are using.

-Ted Allen

BigGuyKen said:
It works somewhat. I am using a select distinct to fill the values that the
user can select for each field. In front of each field is a combo box that
has options of "All Drawings or One Drawing" and "All Work Orders or One Work
Order". I can now not change what is selected in the combo box. At least
you were right, it does not change the value of those fields in the first
record.

Any new suggestions? Thanks....

:

Hi Ken,

First, a disclaimer. Your post said that you are creating the form in
Visual Basic, but I am assuming that you meant the form was created in Access
and you have created some code in Visual Basic for Applications. If that is
incorrect, the following may not apply, although the resolution may still be
similar.

It sounds like your form controls are likely bound to the table fields, and
the OnLoad event is changing their values for the current (first) record.

If you are only using the controls to generate reports, and don't need to
use them to change existing data in the table, you can probably correct the
problem that you are encountering by unbinding the controls. To do this, all
you would have to do is go to the control properties and delete the entry for
the "Control Source" property.

If you want to use the form to make edits as well as generate the reports,
so you want the controls to be bound, you would probably want to revise the
code to navigate to the proper record in the form, rather than changing the
control values for the current record.

If that is the case, Access has a wizard for new combo boxes that will
generate code for you to navigate to a record. You can probably adapt that
code to your situation pretty easily. The general process is to set a
recordset = to Me.Recordsetclone, then use FindFirst on that recordset.
Then, you check the recordset.NoMatch property to see if a match was found,
and if so you set the form bookmark equal to the recordset bookmark.

Post back if my assumptions were incorrect, or if you would like more detail
on any of the above.

HTH, Ted Allen

:

I have an Access table that I want to select certain information from and run
a report. Using Visual Basic I have set up a form that the user can select 2
different fields on. The 2 fields are drawing number and work order number.
When the form displays, I want the values in the selection boxes to be the
current drawing and the current workorder that the user is looking at in
AutoCad. I have figured out that by using the "On Load" of the form that I
can get those values to be the displayed value. When I run the report, it is
correct. If I turn around and run the report again, there is an additional
record on the report. It happens to be the first record in the Access table.
Apparently by using the "On Load" property, it chages and saves the values
to the first record in the table.

How do I get these values to not save? I am extremely new to this type of
programming and any help would be greatly appreciated.

Thanks for any and all help I may receive.
Ken.
 
T

Ted Allen

I'm not sure I completely follow, I'll ask a few more questions if you don't
mind.

Is this an Access form?

What is the main purpose of the form? Are you gathering criteria to be used
to construct the sql for the report data source?

If so, it sounds like this is kind of a query by form setup. If this is the
case, many would usually do something similar to the following:

create an unbound form (no form record source, no control control sources)

create checkboxes, combo boxes, etc to allow the user to specify criteria.
For the combo boxes, set the rowsource type and rowsource as applicable. (by
the way, in your case, you may want to consider checkboxes for the "Include
All WO's" and "Include all Drawings" options.

create a query that references the form control values as necessary to
return the desired records (using Forms![YourFormName]![YourControlName])

create a report that uses the query as it's record source.

Alternatively, for more complex queries, we would usually use VBA to just
construct the query sql and use that for the report's query.

Offhand, I can't think of why Access will not let you change the values in
unbound combo boxes, I haven't encountered that before. But, hopefully
something above will give you an idea. If not, post back with a little more
detail as to the process that you are using.

-Ted Allen
 
T

Ted Allen

My pleasure, glad it helped.

BigGuyKen said:
Thank You very much for your assistance with this problem. Everything is
working like it should now. I appreciate all that you have done for me. I
hope to talk to you again sometime. You were very helpful..

Ken.

Ted Allen said:
Hi Ken,

You may want to check the following:

Did you unbind the form? (delete the entry for the recordsource). This
shouldn't cause the problem that you are encountering, but there is no need
for it to be bound and it will open faster as unbound.

For the combo's, are they still bound to a column? Even though the control
source was deleted, they should still be bound to a column from the row
source (the row source is what provides the selection choices, the bound
column determines the value that will be assigned to the control when a
selection is made, and if a control source has been specified then that value
would be assigned to that underlying field in the table in addition to the
control)

If those all look ok, check the enabled and locked properties. enabled
should be set to yes, and locked to no.

Those are the only things that I can think of off of the top of my head.
I've never encountered unbound controls that would not let me change the
values. Usually, you would only see that if they are locked or disabled.

Hopefully you'll be able to figure the problem out. Once you do, you may
also want to experiment with using list boxes rather than combos if you think
it would be helpful to allow users to select multiple work orders or
drawings. I often do this, and then I use VBA to construct a list of the
ID's that were selected by the user, and add those to the WHERE conditions
using IN() in conjunction with the constructed list.

HTH, Ted Allen

BigGuyKen said:
Yes this is an Access form, and this form is being used to gather criteria to
be used in the SQL Query. I have my "All Drawings and One Drawing" in an
"Option Group" and the values the user can select are in a "ComboBox" beside
it. By removing the 'Control Source' property, I can no longer change the
Option Group or select a different value from the ComboBox list, which is
loaded by the Select Distinct for the field from the table.

If you need anything further, let me know.
Thanks..

:

I'm not sure I completely follow, I'll ask a few more questions if you don't
mind.

Is this an Access form?

What is the main purpose of the form? Are you gathering criteria to be used
to construct the sql for the report data source?

If so, it sounds like this is kind of a query by form setup. If this is the
case, many would usually do something similar to the following:

create an unbound form (no form record source, no control control sources)

create checkboxes, combo boxes, etc to allow the user to specify criteria.
For the combo boxes, set the rowsource type and rowsource as applicable. (by
the way, in your case, you may want to consider checkboxes for the "Include
All WO's" and "Include all Drawings" options.

create a query that references the form control values as necessary to
return the desired records (using Forms![YourFormName]![YourControlName])

create a report that uses the query as it's record source.

Alternatively, for more complex queries, we would usually use VBA to just
construct the query sql and use that for the report's query.

Offhand, I can't think of why Access will not let you change the values in
unbound combo boxes, I haven't encountered that before. But, hopefully
something above will give you an idea. If not, post back with a little more
detail as to the process that you are using.

-Ted Allen

:

It works somewhat. I am using a select distinct to fill the values that the
user can select for each field. In front of each field is a combo box that
has options of "All Drawings or One Drawing" and "All Work Orders or One Work
Order". I can now not change what is selected in the combo box. At least
you were right, it does not change the value of those fields in the first
record.

Any new suggestions? Thanks....

:

Hi Ken,

First, a disclaimer. Your post said that you are creating the form in
Visual Basic, but I am assuming that you meant the form was created in Access
and you have created some code in Visual Basic for Applications. If that is
incorrect, the following may not apply, although the resolution may still be
similar.

It sounds like your form controls are likely bound to the table fields, and
the OnLoad event is changing their values for the current (first) record.

If you are only using the controls to generate reports, and don't need to
use them to change existing data in the table, you can probably correct the
problem that you are encountering by unbinding the controls. To do this, all
you would have to do is go to the control properties and delete the entry for
the "Control Source" property.

If you want to use the form to make edits as well as generate the reports,
so you want the controls to be bound, you would probably want to revise the
code to navigate to the proper record in the form, rather than changing the
control values for the current record.

If that is the case, Access has a wizard for new combo boxes that will
generate code for you to navigate to a record. You can probably adapt that
code to your situation pretty easily. The general process is to set a
recordset = to Me.Recordsetclone, then use FindFirst on that recordset.
Then, you check the recordset.NoMatch property to see if a match was found,
and if so you set the form bookmark equal to the recordset bookmark.

Post back if my assumptions were incorrect, or if you would like more detail
on any of the above.

HTH, Ted Allen

:

I have an Access table that I want to select certain information from and run
a report. Using Visual Basic I have set up a form that the user can select 2
different fields on. The 2 fields are drawing number and work order number.
When the form displays, I want the values in the selection boxes to be the
current drawing and the current workorder that the user is looking at in
AutoCad. I have figured out that by using the "On Load" of the form that I
can get those values to be the displayed value. When I run the report, it is
correct. If I turn around and run the report again, there is an additional
record on the report. It happens to be the first record in the Access table.
Apparently by using the "On Load" property, it chages and saves the values
to the first record in the table.

How do I get these values to not save? I am extremely new to this type of
programming and any help would be greatly appreciated.

Thanks for any and all help I may receive.
Ken.
 
B

BigGuyKen

Yes this is an Access form, and this form is being used to gather criteria to
be used in the SQL Query. I have my "All Drawings and One Drawing" in an
"Option Group" and the values the user can select are in a "ComboBox" beside
it. By removing the 'Control Source' property, I can no longer change the
Option Group or select a different value from the ComboBox list, which is
loaded by the Select Distinct for the field from the table.

If you need anything further, let me know.
Thanks..

Ted Allen said:
I'm not sure I completely follow, I'll ask a few more questions if you don't
mind.

Is this an Access form?

What is the main purpose of the form? Are you gathering criteria to be used
to construct the sql for the report data source?

If so, it sounds like this is kind of a query by form setup. If this is the
case, many would usually do something similar to the following:

create an unbound form (no form record source, no control control sources)

create checkboxes, combo boxes, etc to allow the user to specify criteria.
For the combo boxes, set the rowsource type and rowsource as applicable. (by
the way, in your case, you may want to consider checkboxes for the "Include
All WO's" and "Include all Drawings" options.

create a query that references the form control values as necessary to
return the desired records (using Forms![YourFormName]![YourControlName])

create a report that uses the query as it's record source.

Alternatively, for more complex queries, we would usually use VBA to just
construct the query sql and use that for the report's query.

Offhand, I can't think of why Access will not let you change the values in
unbound combo boxes, I haven't encountered that before. But, hopefully
something above will give you an idea. If not, post back with a little more
detail as to the process that you are using.

-Ted Allen

BigGuyKen said:
It works somewhat. I am using a select distinct to fill the values that the
user can select for each field. In front of each field is a combo box that
has options of "All Drawings or One Drawing" and "All Work Orders or One Work
Order". I can now not change what is selected in the combo box. At least
you were right, it does not change the value of those fields in the first
record.

Any new suggestions? Thanks....
 
B

BigGuyKen

Thank You very much for your assistance with this problem. Everything is
working like it should now. I appreciate all that you have done for me. I
hope to talk to you again sometime. You were very helpful..

Ken.

Ted Allen said:
Hi Ken,

You may want to check the following:

Did you unbind the form? (delete the entry for the recordsource). This
shouldn't cause the problem that you are encountering, but there is no need
for it to be bound and it will open faster as unbound.

For the combo's, are they still bound to a column? Even though the control
source was deleted, they should still be bound to a column from the row
source (the row source is what provides the selection choices, the bound
column determines the value that will be assigned to the control when a
selection is made, and if a control source has been specified then that value
would be assigned to that underlying field in the table in addition to the
control)

If those all look ok, check the enabled and locked properties. enabled
should be set to yes, and locked to no.

Those are the only things that I can think of off of the top of my head.
I've never encountered unbound controls that would not let me change the
values. Usually, you would only see that if they are locked or disabled.

Hopefully you'll be able to figure the problem out. Once you do, you may
also want to experiment with using list boxes rather than combos if you think
it would be helpful to allow users to select multiple work orders or
drawings. I often do this, and then I use VBA to construct a list of the
ID's that were selected by the user, and add those to the WHERE conditions
using IN() in conjunction with the constructed list.

HTH, Ted Allen

BigGuyKen said:
Yes this is an Access form, and this form is being used to gather criteria to
be used in the SQL Query. I have my "All Drawings and One Drawing" in an
"Option Group" and the values the user can select are in a "ComboBox" beside
it. By removing the 'Control Source' property, I can no longer change the
Option Group or select a different value from the ComboBox list, which is
loaded by the Select Distinct for the field from the table.

If you need anything further, let me know.
Thanks..

Ted Allen said:
I'm not sure I completely follow, I'll ask a few more questions if you don't
mind.

Is this an Access form?

What is the main purpose of the form? Are you gathering criteria to be used
to construct the sql for the report data source?

If so, it sounds like this is kind of a query by form setup. If this is the
case, many would usually do something similar to the following:

create an unbound form (no form record source, no control control sources)

create checkboxes, combo boxes, etc to allow the user to specify criteria.
For the combo boxes, set the rowsource type and rowsource as applicable. (by
the way, in your case, you may want to consider checkboxes for the "Include
All WO's" and "Include all Drawings" options.

create a query that references the form control values as necessary to
return the desired records (using Forms![YourFormName]![YourControlName])

create a report that uses the query as it's record source.

Alternatively, for more complex queries, we would usually use VBA to just
construct the query sql and use that for the report's query.

Offhand, I can't think of why Access will not let you change the values in
unbound combo boxes, I haven't encountered that before. But, hopefully
something above will give you an idea. If not, post back with a little more
detail as to the process that you are using.

-Ted Allen

:

It works somewhat. I am using a select distinct to fill the values that the
user can select for each field. In front of each field is a combo box that
has options of "All Drawings or One Drawing" and "All Work Orders or One Work
Order". I can now not change what is selected in the combo box. At least
you were right, it does not change the value of those fields in the first
record.

Any new suggestions? Thanks....

:

Hi Ken,

First, a disclaimer. Your post said that you are creating the form in
Visual Basic, but I am assuming that you meant the form was created in Access
and you have created some code in Visual Basic for Applications. If that is
incorrect, the following may not apply, although the resolution may still be
similar.

It sounds like your form controls are likely bound to the table fields, and
the OnLoad event is changing their values for the current (first) record.

If you are only using the controls to generate reports, and don't need to
use them to change existing data in the table, you can probably correct the
problem that you are encountering by unbinding the controls. To do this, all
you would have to do is go to the control properties and delete the entry for
the "Control Source" property.

If you want to use the form to make edits as well as generate the reports,
so you want the controls to be bound, you would probably want to revise the
code to navigate to the proper record in the form, rather than changing the
control values for the current record.

If that is the case, Access has a wizard for new combo boxes that will
generate code for you to navigate to a record. You can probably adapt that
code to your situation pretty easily. The general process is to set a
recordset = to Me.Recordsetclone, then use FindFirst on that recordset.
Then, you check the recordset.NoMatch property to see if a match was found,
and if so you set the form bookmark equal to the recordset bookmark.

Post back if my assumptions were incorrect, or if you would like more detail
on any of the above.

HTH, Ted Allen

:

I have an Access table that I want to select certain information from and run
a report. Using Visual Basic I have set up a form that the user can select 2
different fields on. The 2 fields are drawing number and work order number.
When the form displays, I want the values in the selection boxes to be the
current drawing and the current workorder that the user is looking at in
AutoCad. I have figured out that by using the "On Load" of the form that I
can get those values to be the displayed value. When I run the report, it is
correct. If I turn around and run the report again, there is an additional
record on the report. It happens to be the first record in the Access table.
Apparently by using the "On Load" property, it chages and saves the values
to the first record in the table.

How do I get these values to not save? I am extremely new to this type of
programming and any help would be greatly appreciated.

Thanks for any and all help I may receive.
Ken.
 

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

Top