Home > Software engineering >  VB "when open mode form can't show no pattern form"
VB "when open mode form can't show no pattern form"

Time:09-25

Child form form6 (member management) click on the "new member" button, load form7 (new members),
 Private Sub Command1_Click () 
Form7. Show 1
End Sub

Double-click Mshflexgrid1, loading form 8 (members),
Private Sub MSHFlexGrid1_DblClick ()
If MSHFlexGrid1. Rows & gt; 2 Then
Form8. Show 1
The Else
The Exit Sub
End the If
End Sub


form7 "ok" buttonPrivate Sub Command2_Click ()
.
Unload Form6
Form6. Show
Unload Form7
End Sub


form8 "ok" buttonPrivate Sub Command2_Click ()
.
Unload Form6
Form6. Show
Unload Form8
End Sub


Runtime form7 sure no mistakes, form8 determine appear "real-time error '401' : when open mode form cannot display schemaless form"

Really don't understand why, help!!!!!!




CodePudding user response:




CodePudding user response:

Form7 "ok" button code
 Private Sub Command2_Click () 
Adodc1. RecordSource="select * from member management", "
Adodc1. Refresh
Adodc1. You. AddNew
Adodc1. You. Fields (" membership number ")=Text1. Text
Adodc1. You. Fields (" the member name ")=Text2. Text
Adodc1. You. Fields (" initials ")=Text3. Text
If Text4. Text="" Then
Adodc1. You. Fields (" member "birthday)=CDate (" 1601-1-1")
The Else
Adodc1. You. Fields (" member "birthday)=CDate (Text4. Text)
End the If
Adodc1. You. Fields (" phone ")=Text5. Text
Adodc1. You. Fields (" member group ")=Combo1. Text
Adodc1. You. Fields (" spending ")=Text6. Text
Adodc1. You. Fields (" available "integral)=Text7. Text
Adodc1. You. Fields (" date of final consumption ")=CDate (" 1601-1-1 ")
Adodc1. You. Update
Unload Form6
Form6. Show
Unload Form7

End Sub



Form8 "ok" button code
 Private Sub Command2_Click () 
Adodc1. RecordSource="select * from member management where membership number='" & amp; Text1. Text & amp; "'
"Adodc1. Refresh
Adodc1. You. Fields (" membership number ")=Text1. Text
Adodc1. You. Fields (" the member name ")=Text2. Text
Adodc1. You. Fields (" initials ")=Text3. Text
If Text4. Text="" Then
Adodc1. You. Fields (" member "birthday)=CDate (" 1601-1-1")
The Else
Adodc1. You. Fields (" member "birthday)=CDate (Text4. Text)
End the If
Adodc1. You. Fields (" phone ")=Text5. Text
Adodc1. You. Fields (" member group ")=Combo1. Text
Adodc1. You. Fields (" spending ")=Text6. Text
Adodc1. You. Fields (" available "integral)=Text7. Text
Adodc1. You. Fields (" date of final consumption ")=CDate (" 1601-1-1 ")
Adodc1. You. Updatef
Unload Form6
Form6. Show
Unload Form8
End Sub


I create a parent form, the form has two buttons, pop two forms, two form button code
Unload form1
Fom1. Show
Unload form2 and unload form3
Running

I feel very strange,,,

CodePudding user response:

As the open forms and closed form no regularity, the in the program on a form can only be opened once, closed, too, in the form is turned off, to open again, see from your code seems to close open for many times, and the order of opening and closing as if also have problem,

In addition, membership management is actually a form can solve a problem, don't know why you have several forms, query, add, modify, delete all bad on a form?

CodePudding user response:

Understanding of window also need deeper

form8 "ok" buttonPrivate Sub Command2_Click ()
.
Unload Form6
Form6. Show & lt;=this is no way to open the mode of Form6, code shouldn't in form8, unload first off form8 wouldn't make a mistake, the problem is this code should not be in form8
Unload Form8
End Sub

CodePudding user response:

First tell you, after the open pattern form, is a model form can be opened, can be kept open mode forms,

In fact, no need for data deletion, with so many models, as the upstairs said, in a form for the,

CodePudding user response:

The from?? Show 0 are all adopt non-modal so, won't appear this mistake

CodePudding user response:

Actually this member query, members to add, modify, delete members, can completely in a form can be completed, why do so complicated,
  • Related