Creating Search & Detail Views with Database Data

R

ridawg

Hey,

I'm pretty sure this can be done just not sure how to do it. I've created an
InfoPath form that's connected to a database. Basically this is what I would
like to do:

1. Create a Search View - The default view is called "Search " - basically
I've added fields that the user can use to search the database and return
about 5 fields they can use to identify the record they are looking for. I
would like to add a sixth column called Details where the user can click the
record they are interested in - taking them to the "Details" view.

2. Create Details View - I would like the detail view to show the 20 plus
fields I have for the selected record with the option to submit updated data
to the database or to return to the search view.

So far I've created the Search view and everything is working great. Just
not sure how to get from the Search view to the Details view.

If someone could help me out this that would be great and if you could show
me how to do this using VBScript that would be a big help.

Thanks!
 
R

ridawg

Thanks for the help! I actually tried something very similar to this but when
I created a Delete button it deleted all the records that matched the user's
query. The Filter setting filters the view but it deletes everything whether
you see it or not.

My form is further complicated by the fact that the the database it's
connected to has 2 tables that are related. With that said I did find a way
to get this all to work.

On my Search view I have:
1. My New Record button (actually 2 buttons - 1 for clearing the search and
the other for creating a new record and switching to the new record view).

2. My query fields - about 5 fields used to query the database.

3. My search results - a repeating table with 5 fields and a sixth column
with a Details button.

For the Details button I've written code that:
1. Captures the original query command.
2. Then I change the query to query my database based on the ID of the
record selected (like you show in your example - I've created an additional
"Helperfield"). 3. Then I switch the view to my Details view.
4. Lastly, I set the query command back to the original query.

Unlike using the Filter this method returns only the data related to the ID
selected rather than returning all the data and filtering to display just the
one record.

This is working great! All my buttons for updating and deleteing a record
are working now.
 
Top