怎么使下面这段代码与form9里的text1文本框联系起来。让text1里的数据添加到下面里面去?
Private Sub Command6_Click()
Form9.Show vbModal If mrc.RecordCount > 0 Then
Dim pName As String
pName = mrc.Fields("inputp").Value
mrc.Open SQL, dbconn, adOpenStatic, adLockOptimistic
SQL = "select * from testdes where inputp"
If mrc.RecordCount > 0 Then
mrc.AddNew
mrc.Fields("inputp").Value = pName
End If
mrc.Update
End If
End Sub
Private Sub Command6_Click()
Form9.Show vbModal If mrc.RecordCount > 0 Then
Dim pName As String
pName = mrc.Fields("inputp").Value
mrc.Open SQL, dbconn, adOpenStatic, adLockOptimistic
SQL = "select * from testdes where inputp"
If mrc.RecordCount > 0 Then
mrc.AddNew
mrc.Fields("inputp").Value = pName
End If
mrc.Update
End If
End Sub
If mrc.RecordCount > 0 Then
Dim pName As String
pName = mrc.Fields("inputp").Value
mrc.Open SQL, dbconn, adOpenStatic, adLockOptimistic是不是应该先mrc.close再mrc.open
Private Sub Command6_Click()
dim MyStr as string Form9.Show vbModal
MyStr = MyVar '取得Form9中的 Text1中的文本
If mrc.RecordCount > 0 Then
Dim pName As String
pName = mrc.Fields("inputp").Value
mrc.Open SQL, dbconn, adOpenStatic, adLockOptimistic
SQL = "select * from testdes where inputp"
If mrc.RecordCount > 0 Then
mrc.AddNew
mrc.Fields("inputp").Value = pName
End If
mrc.Update
End If
End Sub
'Form9 中添加如下代码
Private Sub Form_Unload(Cancel As Integer)
MyVar = Text1.Text
End Sub'Modules 模块中添加
Public MyVar As String
这句
pName = mrc.Fields("inputp").Value
但是提示 无效使用 Null
那就在你要的东西=form9.text1.text就可以了
Private Sub Command6_Click()
Form9.Show vbModal If mrc.RecordCount > 0 Then
' Dim pName As String
' pName = mrc.Fields("inputp").Value
mrc.Open SQL, dbconn, adOpenStatic, adLockOptimistic
SQL = "select * from testdes where inputp"
If mrc.RecordCount > 0 Then
mrc.AddNew
mrc.Fields("inputp").Value = Form9.Text1.Text
End If
mrc.Update
End If
End Sub