I have a ton of queries that I need users to be able to view. I'd like to
have them viewed in a datasheet-view form instead of directly, so that I can
keep the users from futzing with the data.
I'd like to do this in a temporary database, creating an autoform based on
the query and making that form the source object for a subform in a
pre-existing main form. I just ran a quick-and-dirty test, using the code at
the bottom of this post, and it seems to work reasonably well (the client
doesn't have much money to spend, so reasonably well is good enough, or will
be once I tweak the code and nudge the main form).
I'm using Call DoCmd.RunComman d(acCmdNewObjec tAutoForm) to create the form.
It works fine, as long as I've got the query highlighted in the database
window. Is there a way to supply a query name for this wizard? Or is there a
way to control what's highlighted in the database window?
Many thanks for any pointers.
Jeremy
--
Sub MakeTheForm()
Call DoCmd.DeleteObj ect(acForm, "Form1")
Call DoCmd.RunComman d(acCmdNewObjec tAutoForm)
Call DoCmd.Save
Forms!form1.All owEdits = False
Forms!form1.All owAdditions = False
Forms!form1.All owDeletions = False
Call DoCmd.OpenForm( "form1", acDesign)
Forms!form1.Def aultView = 2 'datasheet
Call DoCmd.Save
Call DoCmd.Close(acF orm, "Form1")
Call DoCmd.OpenForm( "frmTempMai n")
Forms!frmMain.S etFocus
End Sub
=============== ==
Jeremy Wallace
AlphaBet City Dataworks
ABCDataworks dot com
have them viewed in a datasheet-view form instead of directly, so that I can
keep the users from futzing with the data.
I'd like to do this in a temporary database, creating an autoform based on
the query and making that form the source object for a subform in a
pre-existing main form. I just ran a quick-and-dirty test, using the code at
the bottom of this post, and it seems to work reasonably well (the client
doesn't have much money to spend, so reasonably well is good enough, or will
be once I tweak the code and nudge the main form).
I'm using Call DoCmd.RunComman d(acCmdNewObjec tAutoForm) to create the form.
It works fine, as long as I've got the query highlighted in the database
window. Is there a way to supply a query name for this wizard? Or is there a
way to control what's highlighted in the database window?
Many thanks for any pointers.
Jeremy
--
Sub MakeTheForm()
Call DoCmd.DeleteObj ect(acForm, "Form1")
Call DoCmd.RunComman d(acCmdNewObjec tAutoForm)
Call DoCmd.Save
Forms!form1.All owEdits = False
Forms!form1.All owAdditions = False
Forms!form1.All owDeletions = False
Call DoCmd.OpenForm( "form1", acDesign)
Forms!form1.Def aultView = 2 'datasheet
Call DoCmd.Save
Call DoCmd.Close(acF orm, "Form1")
Call DoCmd.OpenForm( "frmTempMai n")
Forms!frmMain.S etFocus
End Sub
=============== ==
Jeremy Wallace
AlphaBet City Dataworks
ABCDataworks dot com
Comment