Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connection to Access

Status
Not open for further replies.

rozzay

Programmer
Jan 3, 2002
142
US
Hi I am having some trouble connecting or open my tables from an ACCESS table i set up on my c drive. I keep getting an error that i need to set my object with something or did i reference the wrong library. Please help and thanks in advance.
============================================================
Private Sub Form_Load()
lblDate.Caption = Date
Set rsLogRpt = adoLog.Recordset

End Sub

Private Sub cmdNext_Click()
Dim vbResult As VbMsgBoxResult
If ValidData Then
adoLog.Recordset.Open
If Not adoLog.Recordset.BOF Then
adoLog.Recordset.MoveFirst
End If
adoLog.Recordset.AddNew
strEDPO = txtEDPO.Text
adoLog.Recordset("old_mf") = Trim(strEDPO)
adoLog.Recordset("time") = Date
adoLog.Recordset.Save
' strLoadTime = txtLoadTime.Text
' strXMITLoadTime = txtXMITLoadTime.Text
' strIINGLoadTime = txtIingLoadTime.Text
' strComment = txtComment.Text
adoLog.Recordset.Close
Unload Me
' frmLogResult.Show
frmTemp.Show
End If
End Sub

Private Function ValidData() As Boolean
Dim strMsg As String

If txtEDPO.Text = "" Then
strMsg = "Please enter EDPO50 data."
txtEDPO.SetFocus
' ElseIf txtLoadTime.Text = "" Then
' strMsg = "Please enter the End Time."
' txtLoadTime.SetFocus
' ElseIf txtXMITLoadTime.Text = "" Then
' strMsg = "Please enter the OrderNet End time."
' txtXMITLoadTime.SetFocus
' ElseIf txtIingLoadTime.Text = "" Then
' strMsg = "Please enter the IINGER End time."
' txtIingLoadTime.SetFocus
Else
ValidData = True
End If

If ValidData = False Then
MsgBox strMsg, vbOKOnly
End If

End Function
 
Which line is the code failing at?

What is the error message you are getting?

 
Here is your problem. First I take it you have DIM'd your rsLogRpt, if not do a
[tt]
Dim rsLogRpt as ADODB.Recordset
[/tt]
then you need to change this.
[tt]
Private Sub Form_Load()
lblDate.Caption = Date
Set rsLogRpt = New ADODB.Recordset
Set rsLogRpt = adoLog.Recordset

End Sub
[/tt] Craig, mailto:sander@cogeco.ca

Remember not to name the Lambs...
It only makes the chops harder to swallow
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top