UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Access Runtime Error 2113    
 
   
niva5171
post Apr 20 2016, 11:03 AM
Post#1



Posts: 18
Joined: 11-April 16



Hey all,

I understand that several posts have been made about this error, but I can't find why it is happening to me. 9/10 times it comes down to a lookup function trying to input a string into a textbox that does not support that format (ie. text into a number field). I am doing a basic autofill using recordset, code is below:

Dim rst As DAO.Recordset
Dim rs As DAO.Recordset
Dim rsp As DAO.Recordset
Dim rspat As DAO.Recordset
Dim rsos As DAO.Recordset
Dim rsas As DAO.Recordset
Dim rsass As DAO.Recordset
Dim rsship As DAO.Recordset

Set rs = CurrentDb.OpenRecordset("SELECT [Job#],[To OS],Vendor,[Qty To Outsource],[OS Date],Vendor,[OS Status],[OS Status Type],[OS Docs Complete] FROM [To OS] WHERE [Job#]='" & Me.Job_ & "' and [Due Date] = #" & Me.Due_Date & "#")
Set rsp = CurrentDb.OpenRecordset("SELECT [Ship Date],[Ship%] FROM Pnotes WHERE [Job#]='" & Me.Job_ & "' and [Due Date] = #" & Me.Due_Date & "#")
Set rspat = CurrentDb.OpenRecordset("SELECT [OS Date] FROM [To OS] WHERE [Job#] = '" & Me.Job_ & "' and [Due Date] = #" & Me.Due_Date & "#")
Set rst = CurrentDb.OpenRecordset("SELECT [OS Status],[OS Status Type],[Qty To Outsource],[OS Docs Complete],[To OS] FROM [To Os] WHERE [Job#] = '" & Me.Job_ & "' and [Due Date] = #" & Me.Due_Date & "# and [Vendor] ='" & Forms![P-Notes Home]![Pnotes].Form![txtvendor] & "'")
Set rsos = CurrentDb.OpenRecordset("SELECT [%OS Comp] FROM [OS Comp] WHERE [Job#] = '" & Me.Job_ & "' and [Due Date] = #" & Me.Due_Date & "#")
Set rsas = CurrentDb.OpenRecordset("SELECT [Sent Time] FROM [To OS Vendor] WHERE [Job#] = '" & Me.Job_ & "' and [Due Date] = #" & Me.Due_Date & "#")
Set rsass = CurrentDb.OpenRecordset("SELECT [Sent Time] FROM [To OS Vendor] WHERE [Job#] = '" & Me.Job_ & "' and [Due Date] = #" & Me.Due_Date & "# and [Vendor] ='" & Forms![P-Notes Home]![Pnotes].Form![txtvendor] & "'")
Set rsship = CurrentDb.OpenRecordset("SELECT [Ship Date] FROM [To Ship] WHERE [Job#] = '" & Me.Job_ & "' and [Due Date] = #" & Me.Due_Date & "#")

If rs.RecordCount > 0 Then

If rs.RecordCount < 1 Then
Forms![P-Notes Home]![Pnotes].Form![checkos] = False
Else
Forms![P-Notes Home]![Pnotes].Form![checkos] = rs![TO OS]
End If


If rs.RecordCount >= 1 Then

newos = MsgBox("Job# already is on the To Outsource list, would you like to update a current record?", vbYesNo)

If newos = 6 Then
GoTo Line111
Else
Forms![P-Notes Home]![Pnotes].Form![checkos] = False
Forms![P-Notes Home]![Pnotes].Form![cmbstatus] = ""
Forms![P-Notes Home]![Pnotes].Form![txtstatus] = ""
Forms![P-Notes Home]![Pnotes].Form![txtvendor] = ""
Forms![P-Notes Home]![Pnotes].Form![txtosqty] = ""
Forms![P-Notes Home]![Pnotes].Form![txtosdate] = Date
Forms![P-Notes Home]![Pnotes].Form![checkosdocs] = False
Forms![P-Notes Home]![Pnotes].Form![txtsenttime] = "07/04/1776"

GoTo Line222
End If

Line111:

If rs.RecordCount = 1 Then
GoTo line333
Else
Vendor = InputBox("There are multiples for this Job# on the To Outsource List, please type the name of the vendor you are trying to Update.", "Vendor Name")

If DCount("[Job#]", "[To OS]", "[Job#] = '" & Me.Job_ & "' and [Due Date] = #" & Me.Due_Date & "# and [Vendor] ='" & Vendor & "'") < 1 Then
MsgBox ("This job is currently not listed to go to that vendor. Please check the spelling, and try again.")
GoTo line1111
End If
End If

If IsNull(rs![OS Date]) Or rsp![Ship Date] = "" Then
Forms![P-Notes Home]![Pnotes].Form![txtosdate] = Date
Else
Forms![P-Notes Home]![Pnotes].Form![txtosdate] = rspat![OS Date]
End If

Forms![P-Notes Home]![Pnotes].Form![checkos] = True
Forms![P-Notes Home]![Pnotes].Form![txtvendor] = Vendor
Forms![P-Notes Home]![Pnotes].Form![txtsenttime] = rsass![Sent Time] <-----------ERROR HAPPENS HERE
Forms![P-Notes Home]![Pnotes].Form![txtstatus] = rst![os status]
Forms![P-Notes Home]![Pnotes].Form![cmbstatus] = rst![OS Status Type]
Forms![P-Notes Home]![Pnotes].Form![txtosqty] = rst![Qty To Outsource]
Forms![P-Notes Home]![Pnotes].Form![checkosdocs] = rst![OS Docs Complete][/color][/color][/b]

GoTo Line222



This is what is happening with the code above. I have a table, when they click a field it fills in text fields above. If the certain text appears in another table, it brings up an input box asking for the specific vendor. It should then fill in the information based off of the record with that vendor. But, I get the runtime error at the above spot. If I click end on the error, and execute again, there is no issues. It only happens the first time I run it. Why?!?!?!?!?!

If this makes no sense, it is hard to explain the code without you here.


-Nick
Go to the top of the page
 
niva5171
post Apr 20 2016, 11:08 AM
Post#2



Posts: 18
Joined: 11-April 16



***And yes, I have checked all the textboxes, they are the required format for the data being inserted into it.***
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    12th December 2017 - 06:28 PM