Home > OS >  [to see] VBA in connection access database abnormal!!!!!!!!!!
[to see] VBA in connection access database abnormal!!!!!!!!!!

Time:11-04

Same database connection, database size is not the same as
Click when connected to the big data. MDB database query on the form button will flash {I have data. MDB database to remove most of the record and compressed, now only 256 KB or debug out}
Connection will have the corresponding value of the small and prompt success
Don't know where is the issue, which road immortal to teach?

Sub query methods (1)
Dim CNN As New ADODB. Connection
Dim RST As New ADODB. You
Dim sq1 As String
CNN. Open the provider="Microsoft. Jet. The OLEDB. 4.0; Data source="& amp; ThisWorkbook. Path & amp; "\ data. MDB" '& amp; "; The Jet OLEDB: Database Password="& amp; "Papaya"
'CNN. The Open ". The provider=Microsoft jet. The OLEDB. 4.0; Data source="& amp; ThisWorkbook. Path & amp; "\ mydb MDB" '& amp; "; The Jet OLEDB: Database Password="& amp; "123"
Sq1="Select * from main process where batch number='" & amp; [D5] & amp; "'
"With RST
. Open sq1, CNN, adOpenKeyset, adLockOptimistic
If RST. RecordCount & lt; 1 Then
MsgBox "can't find the record
"The Exit Sub
End the If
[D7]=. Fields (" type ")
'[D9]=. Fields (" batch number ")
'[D11]=. Fields (" date ")
'[D13]=. Fields (" time ")
'[D15]=. Fields (" number ")
[D17]=. Fields (" project ")
[D19]=. Fields (" steps ")
'[D21]=. Fields (" level ")
'[perhaps]=. Fields (" operators ")
'[D25]=. Fields (" tag ")
'[D27]=. Fields (" note ")
'[D29]=. Fields (" document date ")
'[D31]=. Fields (" creates file path ")
'[D33]=. Fields (" pause mark ")
'[D35]=. Fields (" F_OX time ")

End With
MsgBox "find success
"CNN. Close
The Set of CNN=Nothing
End Sub


CodePudding user response:

Do you have any references?
  • Related