Data Access Page with Combo Box and Command button

  • Thread starter Thread starter SeanC
  • Start date Start date
S

SeanC

I have an existing Access 2002 database with a form front-end. I have
recently been trying to figure out Data Access Pages and think it would be
easier to use instead of the form front-end which requires you having to use
the Access program directly. I have run into a couple of problems obtaining
similar functionality with the data access page.

Problem 1. On the form is a Combo box which was set to "Find a record on my
form based on the value I selected in my combo box". I can scroll through
the combo box drop down list and select an entry and all the fields are
populated with the relevant information. It works very slick.

I have created a data access page with essencially the same text boxes that
pull data from related tables. But, I cannot figure out how to put my
existing combo box on the data access form. So, I went ahead and tried to
recreate it. The problem is that I do not have the option to "Find a record
on my form based on the value I selected in my combo box". I figure this is
because it is no longer a form, but a data access page. So, when a entry is
selected in the combobox, it does not go to that entry and populate all the
text fields. Is there anyway to do this on a Data Access Page?

Problem 2. On my form I have a Command button which is set to "Find Record".
This essencially pulls up a find and replace box where I can search through
the entire database. I cannot find a way to do this on the Data Access Page.
When I choose to add a Command button, it does not have the option to "Find
Record".

Any help is highly appreciated. Thank you.
 
SeanC said:
I have an existing Access 2002 database with a form front-end. I have
recently been trying to figure out Data Access Pages and think it would be
easier to use instead of the form front-end which requires you having to use
the Access program directly. I have run into a couple of problems obtaining
similar functionality with the data access page.

Problem 1. On the form is a Combo box which was set to "Find a record on my
form based on the value I selected in my combo box". I can scroll through
the combo box drop down list and select an entry and all the fields are
populated with the relevant information. It works very slick.

I have created a data access page with essencially the same text boxes that
pull data from related tables. But, I cannot figure out how to put my
existing combo box on the data access form. So, I went ahead and tried to
recreate it. The problem is that I do not have the option to "Find a record
on my form based on the value I selected in my combo box". I figure this is
because it is no longer a form, but a data access page. So, when a entry is
selected in the combobox, it does not go to that entry and populate all the
text fields. Is there anyway to do this on a Data Access Page?

Problem 2. On my form I have a Command button which is set to "Find Record".
This essencially pulls up a find and replace box where I can search through
the entire database. I cannot find a way to do this on the Data Access Page.
When I choose to add a Command button, it does not have the option to "Find
Record".

Any help is highly appreciated. Thank you.


You are going to have to do some vbscript programming.

Create the combo box. call it CBFind

Add an onchange event for the object cbfind.

In this example let's say we are finding a customer record. The
unique key is CustomerID.

<SCRIPT LANGUAGE=vbscript FOR=CBFind Event=onchange>
dim rs
set rs = msodsc.defaultrecordset
rs.find "[CustomerID] = '" & document.all.item("CBFind").value
&"'",0,1,1

This isn't part of the code, I am just telling you what the 0, 1,1
means.
0 = skip zero records before starting the search.
1 = search in a forward direction
1 = always begin with the search with the first record in the
recordset
</script>

Hope this helps.

Janet
 
Back
Top