jtinker
04-10-2000, 06:48 PM
I want to create a form whose layout is based upon the values in a table. How do I create a form from scratch, using code?
|
View Full Version : Creating forms in Access Basic jtinker 04-10-2000, 06:48 PM I want to create a form whose layout is based upon the values in a table. How do I create a form from scratch, using code? jtinker 04-13-2000, 10:38 AM Answering my own question: (If someone has a better approach, I'm listening.) Dim i As Integer Dim jftControl As Control Dim jftControlName As String Dim jftDB As Database Dim jftForm As Form Dim jftFormName As String Dim jftOldName As String ' Create form for display jftFormName = "ProductDisplay" Set jftForm = CreateForm() jftOldName = jftForm.FormName ' Close form, to be able to rename it. DoCmd.Close acForm, jftOldName, acSaveYes ' Delete old version of form. On Error Resume Next DoCmd.DeleteObject acForm, jftFormName On Error GoTo Err_Command0_Click DoCmd.Rename NewName:=jftFormName, ObjectType:=acForm, OldName:=jftOldName ' ----- ' Modify form in design mode. Assign record source and caption. DoCmd.OpenForm FormName:=jftFormName, View:=acDesign Set jftForm = Forms(jftFormName) With jftForm .RecordSource = "Product" .Caption = "Product Construction Display" .DefaultView = 1 'Continuous .Detail.Height = 400 End With |