Re: docmd.close makes msaccess crash...
- From: "Alex Dybenko" <alexdyb@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 16 Nov 2006 23:00:25 +0300
Hi,
perhaps you can use a following workaround - instead of delete all tabs you can make a "template" form without tabs, then copy it into a new form and then insert tabs using maakpaginas
--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
"Seppen" <Seppen@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:925CA6EC-062A-40DC-9195-CC9ABAA08F98@xxxxxxxxxxxxxxxx
Because of the problem I have, currently there is only code attached to a
"close button" on the form, so that nothing else can be the cause of this
problem. The only item on the form for the moment is the close button. With
another peace of code I am filling up the form with a tab-element with a few
pages (code attaced) It might thus be that the error I receive is due the
this bit of code?
The goal of this form is to create as much tabs as I have rec's in a
particular table.
Before adding pages, I first clear out all pages / tabelements.
The sub is thus used in a peace of code as following:
verwijdertabs "form1"
maakpaginas "form1", "subformame", 3
this is the sub:
Public Sub maakpaginas(formke As String, subformke As String, amount As Long)
Dim i As Integer
Dim frm As Form
Dim aantal As Long
Dim sjek As Boolean
Dim ctltabset As Control, ctlpage As Control, ctlSub As Control,
ctlCheck As Control, ctlCheckLabel As Control, ctlCmd As Control
DoCmd.OpenForm formke, acDesign
Set frm = Forms(formke)
Set ctltabset = CreateControl(frm.Name, acTabCtl, acDetail, , , 500,
500, 9100, 6100)
ctltabset.Pages(0).Visible = False
ctltabset.Pages(1).Visible = False
For i = 0 To amount - 1
Set ctlpage = CreateControl(frm.Name, acPage, , ctltabset.Name)
ctlpage.Caption = "pagina" & i
Set ctlSub = CreateControl(frm.Name, acSubform, , ctlpage.Name, ,
234, 1500, 9000, 4536)
ctlSub.SourceObject = subformke
Set ctlCheck = CreateControl(frm.Name, acCheckBox, , ctlpage.Name, ,
234, 1000)
Set ctlCheckLabel = CreateControl(frm.Name, acLabel, , ctlpage.Name,
, 500, 970, 4500, 250)
ctlCheckLabel.Caption = "Afgewerkt"
Set ctlCmd = CreateControl(frm.Name, acCommandButton, ,
ctlpage.Name, , 2500, 800, 6770, 450)
ctlCmd.Caption = "Maak registratie"
ctltabset.Left = 200
ctltabset.Top = 200
ctltabset.Width = 9100
Set ctlpage = Nothing
Set ctlSub = Nothing
Set ctlCheck = Nothing
Set ctlCheckLabel = Nothing
Set ctlCmd = Nothing
Next i
Set ctltabset = Nothing
Set frm = Nothing
DoCmd.Close acForm, formke, acSaveYes
end sub
thanks for helping out here!
"Alex Dybenko" wrote:
Hi,
could be that you have some code associated with deleted tab control, then I
suggest to delete such code first
you can also try to delete these tab controls manually and then see if your
code still compiled
--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
"Seppen" <Seppen@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:6DE5FF6A-C32C-450E-8835-D3E326804697@xxxxxxxxxxxxxxxx
> Adjusted sub has the same result: the application crashes:
>
> Public Sub verwijdertabs(formke As String)
>
> Dim frm As Form
> Dim ctltabset As Control
> DoCmd.OpenForm formke, acDesign
> Set frm = Forms(formke)
>
> For Each ctltabset In frm.Controls
> If ctltabset.ControlType = 123 Then
> DeleteControl frm.Name, ctltabset.Name
> End If
> Next
>
> Set frm = Nothing
> DoCmd.Close acForm, "frmWerkOpvolgingsArbeidsgangen", acSaveYes
>
> End Sub
>
> "Alex Dybenko" wrote:
>
>> Hi,
>> try to set frm = nothing before closing form
>>
>> -- >> Best regards,
>> ___________
>> Alex Dybenko (MVP)
>> http://alexdyb.blogspot.com
>> http://www.PointLtd.com
>>
>> "Seppen" <Seppen@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:73CA717A-C76A-4765-99FF-0F24162039E1@xxxxxxxxxxxxxxxx
>> > Hi,
>> >
>> > With the execution of following sub in a global module, msaccess
>> > crashes:
>> > The goal is to delete all tabcontrols of a form and save the design >> > of
>> > the
>> > form.
>> > What goes wrong?
>> >
>> > (msaccess versie 2002, SP3)
>> > (in the eventviewer I see event 1000 & 1001: Faulting application
>> > msaccess.exe, version 10.0.6771.0, faulting module msaccess.exe,
>> > version
>> > 10.0.6771.0, fault address 0x00079bbb.)
>> >
>> >
>> >
>> > Use of the sub is as follows
>> >
>> > verwijdertabs "form1"
>> >
>> >
>> > This is the sub:
>> >
>> >
>> > Public Sub verwijdertabs(formke As String)
>> >
>> > Dim frm As Form
>> > Dim ctltabset As Control
>> > DoCmd.OpenForm formke, acDesign
>> > Set frm = Forms(formke)
>> >
>> > For Each ctltabset In frm.Controls
>> > If ctltabset.ControlType = 123 Then
>> > DeleteControl frm.Name, ctltabset.Name
>> > End If
>> > Next
>> >
>> > DoCmd.Close acForm, formke, acSaveYes
>> >
>> > End Sub
>> >
>>
>>
.
- References:
- Re: docmd.close makes msaccess crash...
- From: Alex Dybenko
- Re: docmd.close makes msaccess crash...
- From: Seppen
- Re: docmd.close makes msaccess crash...
- From: Alex Dybenko
- Re: docmd.close makes msaccess crash...
- From: Seppen
- Re: docmd.close makes msaccess crash...
- Prev by Date: Re: Error in Runsql when space in tablename
- Next by Date: Re: Duplicates on Report
- Previous by thread: Re: docmd.close makes msaccess crash...
- Next by thread: Re: Subform Sort Order
- Index(es):