MySQL Forums
Forum List  »  Connector/ODBC

Random Runtime Error '3197' Assign text to DAO.Recordset ODBC MySQL VARCHAR()
Posted by: Rebeka Fox
Date: February 25, 2018 04:40PM

I'm trying to assign text from a textbox to a dao.recordset record field that is attached to a MySQL VARCHAR() through ODBC. It's failing with an access conflict Runtime Error '3197'. At first i thought it was because i was converting a multiline textbox down to a single line replacing vbNewLine and vbCrLf with \n. I tried using a number of different replacement characters. At first i thought it was letting me pass in a straight string like "abc", but then it started failing to do that as well. i've tried all sorts of quotation gimmicks like """" & str_data & """" or "'" & str_data & "'". i started by passing variables directly, and then i broke it down. i'm really at a loss. there hasn't been a place in my 50000 lines of code that has had this problem. any suggestions would be appreciated. I'm still in dev phase, so no one else is using the program. naturally i did rebuild everything. it does write the information to the table. but it fails after it writes it. I have traced all instances of open recordsets. there aren't any. I can On Error Resume Next, but that sounds like a pretty weak solution.


Public Function Account_Notes(transaction_index As
Integer)
'************************************************************************************
'************************************************************************************
'************************************************************************************
'************************************************************************************
'************************************************************************************

Dim strSQL As String, str_slot As String,
ing, str_data As String

Dim str_client_id_code39 As String

Dim str_month As String, str_year As String,
ing, str_date As String

Dim rst_ctl As DAO.Recordset


'************************************************************************************
'************************************************************************************
'************************************************************************************
'************************************************************************************
'************************************************************************************

Dim input_account_notes(7) As String
input_account_notes(1) =
1) = "input_account_monthly_notes"
input_account_notes(2) =
2) = "input_account_ancilliary_notes"
input_account_notes(3) =
3) = "input_account_awards_notes"
input_account_notes(4) =
4) = "input_account_sale_notes"
input_account_notes(5) =
5) = "input_account_supplies_notes"
input_account_notes(6) =
6) = "input_account_other_notes"
input_account_notes(7) =
7) = "input_account_balance_forward_notes"


Dim fld_account_notes(7) As String
fld_account_notes(1) =
1) = "account_monthly_notes"
fld_account_notes(2) =
2) = "account_ancilliary_notes"
fld_account_notes(3) = "account_awards_notes"
fld_account_notes(4) = "account_sale_notes"
fld_account_notes(5) =
5) = "account_supplies_notes"
fld_account_notes(6) = "account_other_notes"
fld_account_notes(7) =
7) = "account_balance_forward_notes"


str_client_id_code39 =
39 =
Forms!frm_client!frm_client_information("input_client_id_code39")

strSQL = "SELECT *" & _
" FROM [Client Account]" & _
" WHERE [account_client_id_code39] = "
_code39] = " & "'" & str_client_id_code39 & "'" &
_
" ORDER BY [account_id] ASC"

Set rst_ctl = dbs_mac.OpenRecordset(strSQL,
SQL, Type:=dbOpenDynaset)

If rst_ctl.BOF Eqv True Then

[Procedures Core].EmergencyExitFunction
Function ("unable to load account record$.")

GoTo Line1

End If

rst_ctl.MoveLast


str_month = [Procedures
ures
Utility].MonthToNumericStr(Forms!frm_client!frm_client_account("input_account_month"))

str_year =
ar =
Forms!frm_client!frm_client_account("input_account_year")


str_date = str_year & "-" & str_month & "-01"

rst_ctl.FindFirst "[account_tracking] = " &
" & "'" & str_date & "'"

If rst_ctl.NoMatch Eqv True Then

[Procedures Core].EmergencyExitFunction
Function ("could not find date in account
tracking.")

GoTo Line1

End If


str_data =
ta =
Forms!frm_client!frm_client_account(input_account_notes(transaction_index))

str_slot =
ot = fld_account_notes(transaction_index)


rst_ctl.Edit
rst_ctl.Fields(str_slot) = """" & str_data &
ta & """"
rst_ctl.Update


Line1:

If Not (rst_ctl Is Nothing) Then

rst_ctl.Close

Set rst_ctl = Nothing

End If


End Function

Options: ReplyQuote




Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.