Home > Software engineering >  Connection of new cellar, vb6.0 by use access. Fields with. Movenext error
Connection of new cellar, vb6.0 by use access. Fields with. Movenext error

Time:11-09

Implement a window, I want to start the true or false according to the database to control a label shows "activate", "failure",
Then click next to implement a data show,,,
Studied a afternoon today, found to be in the form when you load. The fields caused you. Anything movenext cannot be used, an error code such as screenshots, code is as follows, please solve


Private Sub Form_Load ()

Timer1. Enabled=True

Timer1. Interval=1000

Label_Time. Caption="Current time:" & amp; Now

Display the current time
'
Label_NT. Caption="Login NT:" & amp; Form_Login. Text_NT. Text

Label_User. Caption="Login User:" & amp; Form_Login. Adodc1. You. Fields (" UserName ")

'according to the login screen show the login account and name

Adodc1. The ConnectionString="Provider=Microsoft. Jet. The OLEDB. 4.0; Data Source="& amp; App. The Path & amp; "\ Userlog. MDB; The Jet OLEDB: Database Password=123; Everyone, 123
"
Adodc1.Com mandType=adCmdText

Adodc1. RecordSource="select * from PCBA_Basic_Information"

Adodc1. Refresh
If Adodc1. You. Fields (" Status ")=true Then

Label_Status. Caption="activate"

The Else

Label_Status. Caption="failure"

End the If

End Sub

Private Sub Com_Next_Click ()

With Adodc1. You

. MoveNext

If the EOF Then

. MoveLast

MsgBox "has been in the end,", "note"

End the If

End With

End Sub

CodePudding user response:

Try to put the code on Form_Activate (inside), not in Form_Load ()

CodePudding user response:

Not, o brother, is still the same error,,, the code is the same, I feel you should be the fileds after me to query the value of the column, then. You. Movenext just can't run,,,,,,, I think that is what needs to be a sentence, let you get to the point to the data line,,,,

CodePudding user response:

reference 1st floor show147 response:
try to put the code Form_Activate (inside), not in Form_Load ()

Not, o brother, is still the same error,,, the code is the same, I feel you should be the fileds after me to query the value of the column, then. You. Movenext just can't run,,,,,,, I think that is what needs to be a sentence, let you get to the point to the data line,,,,

CodePudding user response:

Affix the source program and see it!

CodePudding user response:

reference 4 floor show147 response:
affix the source program and see it!

Ah, yes, in the article, I solved the problem, just don't know why the error
I use label_status attribute data binding table, first find the red areas (. Fileds) after the load, execute the command. Movenext conflict, if I delete the red areas, hair. Movenext can use the
Then I cancelled the property sheet label_status data binding, binding to the code, namely label_status. Caption=adodc1. You. Fields (" Status ") to determine is ok,,,
Just don't know why we can't from control the properties of the data binding table + code implementation,,,,
  • Related