code method to switch views

  • Thread starter Thread starter scott
  • Start date Start date
S

scott

hi

I'm trying to make a db interface as 'prat proof' as possible. some people
will want to find and edit their records from the datasheet view, and some
from the form view I have designed

what I would like to do is offer a button on the form view to switch to
datasheet view, and code for a double click on a record on a datasheet view
to switch to a form view for the record clicked on !

with me so far

my questions are

a) can a datasheet even have a double click event ? I can't seem to find a
way to atach one

b) if not, any suggestions for an intuitive method for users to select their
record in datasheet view and get it into form view

c) I can't find a method to switch views. I presume to get from form view to
datasheet view I use the OpenForm method and pass it params, and execute
some close form code at the same time (to close the form down, cluttered
screen etc. etc., we're talking really simple users here !!)

all ideas gratefully recieved

thanks

_scott
 
Hi Scott:
a
way to atach one

No, but you can make a tabular form *** look *** like a "datasheet view" and
there you will be able to add clickbuttons.

b) if not, any suggestions for an intuitive method for users to select their
record in datasheet view and get it into form view

See a)...

c) I can't find a method to switch views. I presume to get from form view to
datasheet view I use the OpenForm method and pass it params, and execute
some close form code at the same time (to close the form down, cluttered
screen etc. etc., we're talking really simple users here !!)

Just place the views as subforms and make them visible/invisible with
something like-

Forms![ParentForm]![ChildForm].form.Visible = True '(or False, as you wish)

Regards,
Al
 
scott said:
hi

I'm trying to make a db interface as 'prat proof' as possible. some
people will want to find and edit their records from the datasheet
view, and some from the form view I have designed

what I would like to do is offer a button on the form view to switch
to datasheet view, and code for a double click on a record on a
datasheet view to switch to a form view for the record clicked on !

with me so far
Yep.

my questions are

a) can a datasheet even have a double click event ? I can't seem to
find a way to atach one

A *form* in datasheet view has events, including the DblClick event,
which is triggered by double-clicking on any of the record selectors or
column headers. You can set an event procedure for this event the way
you would for any form. That same event procedure will fire if the form
is in form view, but only when the user double-clicks on the record
selector. Here's an example:

Private Sub Form_DblClick(Cancel As Integer)

If Me.CurrentView = 1 Then
RunCommand acCmdDatasheetView
Else
RunCommand acCmdFormView
End If

End Sub
b) if not, any suggestions for an intuitive method for users to
select their record in datasheet view and get it into form view

If you're showing the regular form-view menu bar, there's always the

View -> Form View

and

View -> Datasheet View

menu oprions.
c) I can't find a method to switch views. I presume to get from form
view to datasheet view I use the OpenForm method and pass it params,
and execute some close form code at the same time (to close the form
down, cluttered screen etc. etc., we're talking really simple users
here !!)

That's more than you need. See the event procedure I posted above.
 
wow !!

all great ideas, I have been inspired and will take them all onboard

thanks to everyone who posted
 
Back
Top