Home > Software engineering >  Why always appear "standard expression data type does not match the real-time error"
Why always appear "standard expression data type does not match the real-time error"

Time:09-28

Trying to hold the breaker points data data from a text file of brake through Vb into Access database in the "real time brake circuit breaker process data table", the code is always a problem? Just start learning Vb and Aceess, hope to get the great spirit guide?
Text files, the data table structure and code as shown below:
1) text file:
Acquisition time Oi OAd OBd OCd OAp OBp OCp
2015/5/13 11:45:30 0.24 5.12 4.88 5.28 4.96 3.44 3.84
2015/5/13 11:45:31 0.08 5.04 4.72 4.8 5.04 3.52 3.68
2015/5/13 11:45:33 0.24 4.8 4.56 5.04 5.04 3.52 3.84
2015/5/13 11:45:36 0.16 5.04 4.72 4.8 5.04 3.52 3.76
2015/5/13 11:45:37 0.16 4.88 4.64 4.72 4.88 3.44 3.68
2015/5/13 11:45:40 0.32 5.12 4.4 4.88 5.12 3.52 3.76
2015/5/13 11:45:41 0.08 4.96 4.56 4.96 5.04 3.52 3.84
2015/5/13 11:45:42 0.4 5.04 4.72 5.12 5.04 3.44 3.84
2015/5/13 11:45:45 0.16 5.12 4.56 5.04 4.96 3.52 3.84
2015/5/13 11:45:47 0 4.88 4.56 5.28 4.96 3.52 3.84
2015/5/13 11:45:48 0 5.04 4.56 4.96 4.96 3.52 3.84
2015/5/13 11:45:49 0.08 5.2 4.48 5.12 5.04 3.44 3.92
2015/5/13 11:45:51 0.08 5.04 4.64 5.04 5.04 3.44 3.84
2015/5/13 11:45:52 0 5.04 4.56 5.28 5.04 3.52 3.84
2015/5/13 11:45:55 0.16 5.12 4.48 4.96 4.96 3.52 3.84
2015/5/13 11:45:57 0.08 5.12 4.56 5.12 5.04 3.52 3.92
2015/5/13 11:45:58 0.24 5.12 4.56 4.96 4.96 3.52 3.84
2015/5/13 11:45:59 0.16 5.04 4.64 4.96 5.12 3.52 3.76
2) data table structure
The field name data type
Break-brake collection date/time
Oi text
OAd text
OBd text
OCd text
OAp text
OBp text
OCp text
3) code
 Option Explicit 
Option Base 1
Dim CNN As ADODB. Connection

Private Sub Command1_Click ()
Dim break-brake acquisition time $, Oi $, OAd $, OBd $, OCd $, OAp $, OBp $, OCp $
Open "C: \ Users \ \ Administrator \ Desktop \ \ \ circuit breaker design data management system database data points brake process. TXT" For Input As # 1
The Do While Not EOF (1)
Input # 1, break-brake acquisition time
Print break-brake acquisition time
Loop
Close # 1
MsgBox "complete"
End Sub

Private Sub Command2_Click ()
Dim sql1 $
Dim break-brake acquisition time As the Date
Dim Oi $, OAd $, OBd $, OCd $, OAp $, OBp $, OCp $
Open "C: \ Users \ \ Administrator \ Desktop \ \ \ circuit breaker design data management system database data points brake process. TXT" For Input As # 1
The Do While Not EOF (1)
Input # 1, break-brake acquisition time
Sql1="insert into a circuit breaker in brake process data table (break-brake acquisition time, Oi, OAd, OBd, OCd, OAp, OBp, OCp) composition among values (' #" & amp; Trim (break-brake acquisition time) & amp; "', '" & amp; Trim (Oi) & amp; "', '" & amp; Trim (OAd) & amp; "', '" & amp; Trim (OBd) & amp; "', '" & amp; Trim (OCd) & amp; "', '" & amp; Trim (OAp) & amp; "', '" & amp; Trim (OBp) & amp; "', '" & amp; Trim (OCp) composition among & amp; "')
"CNN. The Execute (sql1)
Loop
Close # 1
Cnn.Com mitTrans
MsgBox "complete"
End Sub

Private Sub Form_Load ()
Set the CNN=New ADODB. Connection
CNN. The ConnectionString="Provider=Microsoft. Jet. The OLEDB. 4.0; Data Source="& amp; App. The Path & amp; "\ fenhe. MDB; Persist Security Info=False "
CNN. ConnectionTimeout=30
CNN. Open
CNN. BeginTrans
End Sub

4) real-time mistakes: standard expression data type does not match

CodePudding user response:

You can track your those variables have content?

CodePudding user response:

What do you mean?

CodePudding user response:

The Line Input
The Split
  •  Tags:  
  • VBA
  • Related