Is there a way to create Access form dynamically?
Problem: I have a couple of views (Access ADP with SQL Server). I want to create a basic continuous form for those views, one form for each view. These views contain totally differences column name depend on the modu开发者_JS百科le they are in.
Say one view may be about Student Score with 10 columns. Other may be about Student Skills in the past with 20 columns. However, there are one thing in common for these forms is a StudentID
column, which allows user to double-click. By doing so, it call Student Form.
Right now, I manually create these continuous forms for each view repeatedly. I am thinking to myself it should be good if I can create it dynamically. For example, if we change or add a new view. I have no need to change column for these forms because it generates on the fly each time it is called.
I am not sure that it is possible to do that in Access ADP.
You seem to be looking for Application.CreateForm Method (Access)
To quote:
This example creates a new form in the Northwind sample database based on the Customers form, and sets its RecordSource property to the Customers table. Run this code from the Northwind sample database.
Sub NewForm()
Dim frm As Form
' Create form based on Customers form.
Set frm = CreateForm( , "Customers")
DoCmd.Restore
' Set RecordSource property to Customers table.
frm.RecordSource = "Customers"
End Sub
精彩评论