在表单中,当按下名为“asignar”的按钮时,我想将值插入名为“movimientos”的现有表中
Private Sub ASIGNAR_Click()
Dim db As Database
Dim rs As DAO.Recordset
Set rs = db.OpenRecordset("MOVIMIENTOS")
rs.AddNew
rs("ESTATUSDOC").Value = "Blah"
rs("FOLIOFED").Value = "Blah"
rs("NOMBREDOC").Value = "Blah"
rs("PREL").Value = "Blah"
rs("CURP").Value = "Blah"
rs.Update
End Sub
当我按下跑步时,它会继续显示错误:
错误91对象变量或未设置块变量
答案 0 :(得分:3)
我认为你的语法有点偏,你的代码应该是这样的:
import json
import pandas as pd
from textblob import TextBlob
tweets_data_path = 'filename.txt'
tweets_data = []
tweets_file = open(tweets_data_path, "r")
for line in tweets_file:
try:
tweet = json.loads(line)
tweets_data.append(tweet)
except:
continue
print (len(tweets_data))
tweets = pd.DataFrame()
tweets['text'] = list(map(lambda tweet: tweet['text'], tweets_data))
tweets['lang'] = list(map(lambda tweet: tweet['lang'], tweets_data))
tweets['country'] = list(map(lambda tweet: tweet['place']['country'] if tweet['place'] != None else None, tweets_data))
avg = 0
for lol in tweets['text']:
tweet = TextBlob(text)
avg = tweet.sentiment.polarity + avg
avg = avg/len(tweets)
print(avg)
问题主要在于您声明和设置Private Sub ASIGNAR_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("MOVIMIENTOS", dbOpenDynaset, dbAppendOnly)
rs.AddNew
rs("ESTATUSDOC").Value = "Blah"
rs("FOLIOFED").Value = "Blah"
rs("NOMBREDOC").Value = "Blah"
rs("PREL").Value = "Blah"
rs("CURP").Value = "Blah"
rs.Update
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
变量的方式。我还调整了db
以匹配您正在做的事情。
答案 1 :(得分:0)
更改
Set rs = CurrentDB.OpenRecordset("MOVIMIENTOS")
到
Dim db As Database
也应该修复它。然后,您可能会失去{{1}}