Change form's view

H

Howard

Hi!
I've figured most of it out. All I need now is how to switch from a
datasheet view to a forms view and back using coded "click" events on
specific fields. Any suggestions?
 
D

Dirk Goldgar

Howard said:
Hi!
I've figured most of it out. All I need now is how to switch from a
datasheet view to a forms view and back using coded "click" events on
specific fields. Any suggestions?

Switch active form to datasheet view:

RunCommand acCmdDatasheetView

Switch active form to form view:

RunCommand acCmdFormView

To toggle the view:

Select Case Screen.ActiveForm.CurrentView
Case 1
' Currently in form view
RunCommand acCmdDatasheetView
Case 2
' Currently in datasheet view
RunCommand acCmdFormView
Case Else
' Must be design view (0) or some as yet undefined view
' Do nothing.
End Select
 
6

'69 Camaro

Hi, Howard.

To switch to datasheet view, try:

RunCommand acCmdDatasheetView


To switch to form view, try:

RunCommand acCmdFormView

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)
 

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