General Declarations Location

S

shhsecurity

I am still a bit green when it comes to ACCESS. Where exactly is the General
Declarations section of your form’s module? I need to put some code in there
to start fixing a combo box.
 
M

MacDermott

Perhaps you could explain what needs fixed in your combobox, and why you
think adding code to General Declarations is a good way to go about this.

Much of your code page is filled with Event Procedures - code which runs in
response to some event which happens on a form - e.g. Move to a new record,
change a value in a textbox.
Items which should be available in all Event Procedures are declared (using
Public, Private, or Dim) in the General Declarations section.
It's hard to say much more than that without more details of what you're
trying to do.
 
B

Brendan Reynolds

If it is outside of any procedure, it is in the general declarations
section. By convention, though, most developers add these things at the top
of the module, just below the Option Compare Database and Option Explicit
statements.
 
S

shhsecurity

Yes of course.

What I am trying to accomplish is a special search where I can find a
particular record in my Lost&Found database. This database is cluttered with
like items and where one record may have the description: glasses gold,
another record will have the description: gold glasses. I want a search
function that will take all of the instances of glasses in the database and
sort them according to date and list the full description. This I hope to
accomplish with a combo box so that once I find the record I can just click
on it and the record will be displayed. Right now I have a combobox set up
with three fields: ID #, DATE FOUND:, and ITEM/S DESC: , but when trying to
search for a record only the description shows and typing into the combobox
search field brings up hundreds of like items. [question...why does the
combobox wizard allow more fields to search by If It does not utilize it when
you finish the wizard? Only one field is displayed.] Anyway, The table is
named Lost&Found and the fields I want to use in the combobox are DATE
FOUND:, ITEM/S DESC:, AND ID #. The code I wanted to use and modify is here:
http://www.mcseweb.net/Tutorals/AccessPages/Combos with Tens of Thousands of Records.htm

Is this possible?
 
M

MacDermott

Without having looked at the site you mention, might I suggest an alternate
approach?
You could build a continuous form displaying the data fields you want from
your table.
Click on the "Filter By Form" button in your toolbar.
In the ITEM/S DESC: field, type this:
Like "*glasses*"
Then click the Filter button in the toolbar.

Your form should now be filtered to show only items which include the word
"glasses" in the ITEM/S DESC: field.

If you like, you can now put your cursor in the DATE FOUND: field, then
click on the Sort button in the toolbar.

HTH
- Turtle

shhsecurity said:
Yes of course.

What I am trying to accomplish is a special search where I can find a
particular record in my Lost&Found database. This database is cluttered with
like items and where one record may have the description: glasses gold,
another record will have the description: gold glasses. I want a search
function that will take all of the instances of glasses in the database and
sort them according to date and list the full description. This I hope to
accomplish with a combo box so that once I find the record I can just click
on it and the record will be displayed. Right now I have a combobox set up
with three fields: ID #, DATE FOUND:, and ITEM/S DESC: , but when trying to
search for a record only the description shows and typing into the combobox
search field brings up hundreds of like items. [question...why does the
combobox wizard allow more fields to search by If It does not utilize it when
you finish the wizard? Only one field is displayed.] Anyway, The table is
named Lost&Found and the fields I want to use in the combobox are DATE
FOUND:, ITEM/S DESC:, AND ID #. The code I wanted to use and modify is here:http://www.mcseweb.net/Tutorals/AccessPages/Combos with Tens of Thousands of Records.htm

Is this possible?

MacDermott said:
Perhaps you could explain what needs fixed in your combobox, and why you
think adding code to General Declarations is a good way to go about this.

Much of your code page is filled with Event Procedures - code which runs in
response to some event which happens on a form - e.g. Move to a new record,
change a value in a textbox.
Items which should be available in all Event Procedures are declared (using
Public, Private, or Dim) in the General Declarations section.
It's hard to say much more than that without more details of what you're
trying to do.

in
there
 
S

shhsecurity

I opened the Lost&Found form and clicked on Filter by Form. Entered a
wilcard search for data in the items/desc field and then clicked on Apply
Filter. I got an error message that stated: The table 'Lost&Found' is
already opened exclusively by another user, or it is already open through the
user interface and cannot be manipulated programmatically. <clicked on OK>
another error: MAIN may not be able to apply the filter if you entered an
invalid data type in one of the fields. Do you want to close the filter
anyway? If you click yes MAIN will build the filter, but won't apply it to
the recordset. Then it will close the Filter by Form window. <clicked yes>
Clicking yes brought me to another error message stating: 'MAIN cannot apply
the filter because all of the records are locked. The recordlocks property
of the form or report or the Default Record locking option on the Advanced
tab of the Options dialog box (tools menu) is set to All Records. Reset the
value to No Locks or Edited Record as appropriate. <clicked ok> The Filter
by Form window disappears.
I went into options/Advanced and changed the settings to No Locks. The
window error mesasages still pop up with the same thing. ???

MacDermott said:
Without having looked at the site you mention, might I suggest an alternate
approach?
You could build a continuous form displaying the data fields you want from
your table.
Click on the "Filter By Form" button in your toolbar.
In the ITEM/S DESC: field, type this:
Like "*glasses*"
Then click the Filter button in the toolbar.

Your form should now be filtered to show only items which include the word
"glasses" in the ITEM/S DESC: field.

If you like, you can now put your cursor in the DATE FOUND: field, then
click on the Sort button in the toolbar.

HTH
- Turtle

shhsecurity said:
Yes of course.

What I am trying to accomplish is a special search where I can find a
particular record in my Lost&Found database. This database is cluttered with
like items and where one record may have the description: glasses gold,
another record will have the description: gold glasses. I want a search
function that will take all of the instances of glasses in the database and
sort them according to date and list the full description. This I hope to
accomplish with a combo box so that once I find the record I can just click
on it and the record will be displayed. Right now I have a combobox set up
with three fields: ID #, DATE FOUND:, and ITEM/S DESC: , but when trying to
search for a record only the description shows and typing into the combobox
search field brings up hundreds of like items. [question...why does the
combobox wizard allow more fields to search by If It does not utilize it when
you finish the wizard? Only one field is displayed.] Anyway, The table is
named Lost&Found and the fields I want to use in the combobox are DATE
FOUND:, ITEM/S DESC:, AND ID #. The code I wanted to use and modify is here:http://www.mcseweb.net/Tutorals/AccessPages/Combos with Tens of Thousands of Records.htm

Is this possible?

MacDermott said:
Perhaps you could explain what needs fixed in your combobox, and why you
think adding code to General Declarations is a good way to go about this.

Much of your code page is filled with Event Procedures - code which runs in
response to some event which happens on a form - e.g. Move to a new record,
change a value in a textbox.
Items which should be available in all Event Procedures are declared (using
Public, Private, or Dim) in the General Declarations section.
It's hard to say much more than that without more details of what you're
trying to do.

I am still a bit green when it comes to ACCESS. Where exactly is the
General
Declarations section of your form's module? I need to put some code in
there
to start fixing a combo box.
 
M

MacDermott

I'd suggest you comment out any code using DAO or ADO to do your filtering.

Is MAIN the name of your form? Your database?

I'd also suggest avoiding non-standard characters like & in your names.
LostFound might work well.

Here's a quick test you could do:
Copy your Lost&Found table - rename it LostFound.
Use the wizard to create a form based on it.
Try using FilterByForm from the button on this form.

HTH

shhsecurity said:
I opened the Lost&Found form and clicked on Filter by Form. Entered a
wilcard search for data in the items/desc field and then clicked on Apply
Filter. I got an error message that stated: The table 'Lost&Found' is
already opened exclusively by another user, or it is already open through the
user interface and cannot be manipulated programmatically. <clicked on OK>
another error: MAIN may not be able to apply the filter if you entered an
invalid data type in one of the fields. Do you want to close the filter
anyway? If you click yes MAIN will build the filter, but won't apply it to
the recordset. Then it will close the Filter by Form window. <clicked yes>
Clicking yes brought me to another error message stating: 'MAIN cannot apply
the filter because all of the records are locked. The recordlocks property
of the form or report or the Default Record locking option on the Advanced
tab of the Options dialog box (tools menu) is set to All Records. Reset the
value to No Locks or Edited Record as appropriate. <clicked ok> The Filter
by Form window disappears.
I went into options/Advanced and changed the settings to No Locks. The
window error mesasages still pop up with the same thing. ???

MacDermott said:
Without having looked at the site you mention, might I suggest an alternate
approach?
You could build a continuous form displaying the data fields you want from
your table.
Click on the "Filter By Form" button in your toolbar.
In the ITEM/S DESC: field, type this:
Like "*glasses*"
Then click the Filter button in the toolbar.

Your form should now be filtered to show only items which include the word
"glasses" in the ITEM/S DESC: field.

If you like, you can now put your cursor in the DATE FOUND: field, then
click on the Sort button in the toolbar.

HTH
- Turtle

shhsecurity said:
Yes of course.

What I am trying to accomplish is a special search where I can find a
particular record in my Lost&Found database. This database is
cluttered
with
like items and where one record may have the description: glasses gold,
another record will have the description: gold glasses. I want a search
function that will take all of the instances of glasses in the
database
and
sort them according to date and list the full description. This I hope to
accomplish with a combo box so that once I find the record I can just click
on it and the record will be displayed. Right now I have a combobox
set
up
with three fields: ID #, DATE FOUND:, and ITEM/S DESC: , but when
trying
to
search for a record only the description shows and typing into the combobox
search field brings up hundreds of like items. [question...why does the
combobox wizard allow more fields to search by If It does not utilize
it
when
you finish the wizard? Only one field is displayed.] Anyway, The
table
is
named Lost&Found and the fields I want to use in the combobox are DATE
FOUND:, ITEM/S DESC:, AND ID #. The code I wanted to use and modify
is
here: http://www.mcseweb.net/Tutorals/AccessPages/Combos with Tens of Thousands of Records.htm
Is this possible?

:

Perhaps you could explain what needs fixed in your combobox, and why you
think adding code to General Declarations is a good way to go about this.

Much of your code page is filled with Event Procedures - code which
runs
in
response to some event which happens on a form - e.g. Move to a new record,
change a value in a textbox.
Items which should be available in all Event Procedures are declared (using
Public, Private, or Dim) in the General Declarations section.
It's hard to say much more than that without more details of
what
you're
trying to do.

I am still a bit green when it comes to ACCESS. Where exactly is the
General
Declarations section of your form's module? I need to put some
code
in
there
to start fixing a combo box.
 
S

shhsecurity

DAO / ADO ???

MAIN is the name of my database.

Also, thank you for that suggestion. That cleared up those error messages
and now I can filter by form and find my like items. Is it possible to use
another switchboard and integrate the filter by form for each form? Say,
having a switchboard that does nothing but search forms? I believe I can
figure this all out, I am just wondering If there is anything I might have to
do special to make this work.

Appreciate all the time you have given me.


MacDermott said:
I'd suggest you comment out any code using DAO or ADO to do your filtering.

Is MAIN the name of your form? Your database?

I'd also suggest avoiding non-standard characters like & in your names.
LostFound might work well.

Here's a quick test you could do:
Copy your Lost&Found table - rename it LostFound.
Use the wizard to create a form based on it.
Try using FilterByForm from the button on this form.

HTH

shhsecurity said:
I opened the Lost&Found form and clicked on Filter by Form. Entered a
wilcard search for data in the items/desc field and then clicked on Apply
Filter. I got an error message that stated: The table 'Lost&Found' is
already opened exclusively by another user, or it is already open through the
user interface and cannot be manipulated programmatically. <clicked on OK>
another error: MAIN may not be able to apply the filter if you entered an
invalid data type in one of the fields. Do you want to close the filter
anyway? If you click yes MAIN will build the filter, but won't apply it to
the recordset. Then it will close the Filter by Form window. <clicked yes>
Clicking yes brought me to another error message stating: 'MAIN cannot apply
the filter because all of the records are locked. The recordlocks property
of the form or report or the Default Record locking option on the Advanced
tab of the Options dialog box (tools menu) is set to All Records. Reset the
value to No Locks or Edited Record as appropriate. <clicked ok> The Filter
by Form window disappears.
I went into options/Advanced and changed the settings to No Locks. The
window error mesasages still pop up with the same thing. ???

MacDermott said:
Without having looked at the site you mention, might I suggest an alternate
approach?
You could build a continuous form displaying the data fields you want from
your table.
Click on the "Filter By Form" button in your toolbar.
In the ITEM/S DESC: field, type this:
Like "*glasses*"
Then click the Filter button in the toolbar.

Your form should now be filtered to show only items which include the word
"glasses" in the ITEM/S DESC: field.

If you like, you can now put your cursor in the DATE FOUND: field, then
click on the Sort button in the toolbar.

HTH
- Turtle

Yes of course.

What I am trying to accomplish is a special search where I can find a
particular record in my Lost&Found database. This database is cluttered
with
like items and where one record may have the description: glasses gold,
another record will have the description: gold glasses. I want a search
function that will take all of the instances of glasses in the database
and
sort them according to date and list the full description. This I hope to
accomplish with a combo box so that once I find the record I can just
click
on it and the record will be displayed. Right now I have a combobox set
up
with three fields: ID #, DATE FOUND:, and ITEM/S DESC: , but when trying
to
search for a record only the description shows and typing into the
combobox
search field brings up hundreds of like items. [question...why does the
combobox wizard allow more fields to search by If It does not utilize it
when
you finish the wizard? Only one field is displayed.] Anyway, The table
is
named Lost&Found and the fields I want to use in the combobox are DATE
FOUND:, ITEM/S DESC:, AND ID #. The code I wanted to use and modify is
here:

http://www.mcseweb.net/Tutorals/AccessPages/Combos with Tens of Thousands of Records.htm

Is this possible?

:

Perhaps you could explain what needs fixed in your combobox, and why you
think adding code to General Declarations is a good way to go about
this.

Much of your code page is filled with Event Procedures - code which runs
in
response to some event which happens on a form - e.g. Move to a new
record,
change a value in a textbox.
Items which should be available in all Event Procedures are declared
(using
Public, Private, or Dim) in the General Declarations section.
It's hard to say much more than that without more details of what
you're
trying to do.

I am still a bit green when it comes to ACCESS. Where exactly is the
General
Declarations section of your form's module? I need to put some code
in
there
to start fixing a combo box.
 
M

MacDermott

Filter By Form should work on just about any form.
You shouldn't have to build a special form to do your filtering.

I'm guessing that the error messages you were getting stem from the search
code you had pasted into your form.
You might try removing it and see if that solves the problem.
Otherwise, you could try rebuilding that form from the start, but without
that search code.

HTH

shhsecurity said:
DAO / ADO ???

MAIN is the name of my database.

Also, thank you for that suggestion. That cleared up those error messages
and now I can filter by form and find my like items. Is it possible to use
another switchboard and integrate the filter by form for each form? Say,
having a switchboard that does nothing but search forms? I believe I can
figure this all out, I am just wondering If there is anything I might have to
do special to make this work.

Appreciate all the time you have given me.


MacDermott said:
I'd suggest you comment out any code using DAO or ADO to do your filtering.

Is MAIN the name of your form? Your database?

I'd also suggest avoiding non-standard characters like & in your names.
LostFound might work well.

Here's a quick test you could do:
Copy your Lost&Found table - rename it LostFound.
Use the wizard to create a form based on it.
Try using FilterByForm from the button on this form.

HTH

shhsecurity said:
I opened the Lost&Found form and clicked on Filter by Form. Entered a
wilcard search for data in the items/desc field and then clicked on Apply
Filter. I got an error message that stated: The table 'Lost&Found' is
already opened exclusively by another user, or it is already open
through
the
user interface and cannot be manipulated programmatically. <clicked
on
OK>
another error: MAIN may not be able to apply the filter if you entered an
invalid data type in one of the fields. Do you want to close the filter
anyway? If you click yes MAIN will build the filter, but won't apply
it
to
the recordset. Then it will close the Filter by Form window. <clicked yes>
Clicking yes brought me to another error message stating: 'MAIN cannot apply
the filter because all of the records are locked. The recordlocks property
of the form or report or the Default Record locking option on the Advanced
tab of the Options dialog box (tools menu) is set to All Records.
Reset
the
value to No Locks or Edited Record as appropriate. <clicked ok> The Filter
by Form window disappears.
I went into options/Advanced and changed the settings to No Locks. The
window error mesasages still pop up with the same thing. ???

:

Without having looked at the site you mention, might I suggest an alternate
approach?
You could build a continuous form displaying the data fields you
want
from
your table.
Click on the "Filter By Form" button in your toolbar.
In the ITEM/S DESC: field, type this:
Like "*glasses*"
Then click the Filter button in the toolbar.

Your form should now be filtered to show only items which include
the
word
"glasses" in the ITEM/S DESC: field.

If you like, you can now put your cursor in the DATE FOUND: field, then
click on the Sort button in the toolbar.

HTH
- Turtle

Yes of course.

What I am trying to accomplish is a special search where I can find a
particular record in my Lost&Found database. This database is cluttered
with
like items and where one record may have the description: glasses gold,
another record will have the description: gold glasses. I want a search
function that will take all of the instances of glasses in the database
and
sort them according to date and list the full description. This I hope to
accomplish with a combo box so that once I find the record I can just
click
on it and the record will be displayed. Right now I have a
combobox
set
up
with three fields: ID #, DATE FOUND:, and ITEM/S DESC: , but when trying
to
search for a record only the description shows and typing into the
combobox
search field brings up hundreds of like items. [question...why
does
the
combobox wizard allow more fields to search by If It does not
utilize
it
when
you finish the wizard? Only one field is displayed.] Anyway, The table
is
named Lost&Found and the fields I want to use in the combobox are DATE
FOUND:, ITEM/S DESC:, AND ID #. The code I wanted to use and
modify
is
http://www.mcseweb.net/Tutorals/AccessPages/Combos with Tens of Thousands of Records.htm
Is this possible?

:

Perhaps you could explain what needs fixed in your combobox, and
why
you
think adding code to General Declarations is a good way to go about
this.

Much of your code page is filled with Event Procedures - code
which
runs
in
response to some event which happens on a form - e.g. Move to a new
record,
change a value in a textbox.
Items which should be available in all Event Procedures are declared
(using
Public, Private, or Dim) in the General Declarations section.
It's hard to say much more than that without more details of what
you're
trying to do.

I am still a bit green when it comes to ACCESS. Where exactly
is
the
General
Declarations section of your form's module? I need to put
some
code
in
there
to start fixing a combo box.
 
Top