I have a table EmpRequirements, the fields are:
EmpRequirementsID (AutoNumber),
EmpID (from the Employees Table),
RequirementID (from the Requirement Table),
RequirementName (from the Requirement Table),
Received_OnFile (Check),
NotApplicable (Check),
DateReceived (Date),
ExpirationDate (Date)
What I want to do is have a Button (Add Requirements) that on Click will add all of the data from Requirement Table (Requirement ID, and RequirementName) for the Employee that is current on my form. If I add a Requirement I would like to be able to click the Button and it will add any and all Requirements to that employee that currently do not exist for that employee.
This would then show up in the form as a Subform datasheet where the user can then edit all of the other fields in the EmpRequirements.
I have tried to use Append and Update and to date have not come up with the answer. I wonder if this could be just an easy Macro to write.
I have tried to add the records using this statement, I have ' out the error handler, and am getting the run time error 3134 - syntax error insert into statement
Private Sub Add_Click()
' On Error GoTo Err_Add_Click
Dim strSQL1 As String
strSQL1 = "INSERT IGNORE INTO [EmpRequirements]( [EmpID], [RequirementID], [RequirementName] )" & _
"SELECT DISTINCT [Employees].[EmpID], [Requirement].[RequirementID], [Requirement].[RequirementName]" & _
"FROM [Employees], [Requirement] " & _
"WHERE (((Employees.EmpID)=[Forms]![Employee Details]![EmpID]));"
DoCmd.RunSQL strSQL1
[Forms]![Employee Details].Refresh 'Refresh after update EmpRequirements Subform
'Exit_Add_Click: ' Label to resume after error.
' Exit Sub ' Exit before error handler.
'Err_Add_Click: ' Label to jump to on error.
' MsgBox Err.Number & Err.Description ' Place error handling here.
' Resume Exit_Add_Click ' Pick up again and quit.
End Sub
Will this work and can you help with the error?
Here is the answer I came up with
Private Sub Add_Click()
On Error GoTo errHandler
Dim strSQL1 As String
DoCmd.SetWarnings False
strSQL1 = "INSERT INTO EmpRequirements ( EmpID, RequirementID, RequirementName ) " & _
"SELECT SQ1.EmpID, SQ1.RequirementID, SQ1.RequirementName " & _
"FROM (SELECT Employees.EmpID, Requirement.RequirementID, Requirement.RequirementName " & _
"FROM Employees, Requirement WHERE (((Employees.EmpID)=[Forms]![Employee Details]![EmpID]))) " & _
"AS SQ1 LEFT JOIN EmpRequirements ON (SQ1.EmpID=EmpRequirements.EmpID) " & _
"AND (SQ1.RequirementID= EmpRequirements.RequirementID) " & _
"WHERE EmpRequirements.RequirementID IS NULL;"
DoCmd.RunSQL strSQL1
DoCmd.SetWarnings True
[Forms]![Employee Details].Refresh 'Refresh after update EmpRequirements Subform
Exit Sub ' Exit before error handler.
errHandler: ' Label to jump to on error.
MsgBox "Error " & Err.Number & ": " & Err.Description & " in " & _
VBE.ActiveCodePane.CodeModule, vbOKOnly, "Error"
End Sub
Thanks all
Related
I am running Windows 7 Professional. I have an MS Access frontend to an MS Access backend. The form that opens at the start of opening the frontend causes the app to crash.
Here is the code:
Private Sub Form_Open(Cancel As Integer)
Dim strMyDir As String
Dim intPos As Integer
Dim rst As dao.Recordset
Dim strSQL As String
Dim rstWhatsNew As dao.Recordset
DoCmd.ShowToolbar "Database", acToolbarNo
DoCmd.ShowToolbar "Toolbox", acToolbarNo
DoCmd.ShowToolbar "Form View", acToolbarNo
If Application.GetOption("ShowWindowsInTaskbar") = -1 Then
Application.SetOption "ShowWindowsInTaskbar", 0
End If
If DLookup("Locked", "luLockOut") <> 0 Then
MsgBox "Database is being worked on. Please try back in a couple minutes.", vbInformation, " "
DoCmd.Quit
Else
strSQL = "Select * From tblLastLogins Where UserName = '" & GetCurrentUserName() & "'"
This is where I have traced the error to: GetCurrentUserName()
Set rst = CurrentDb.OpenRecordset(strSQL)
With rst
If Not .EOF Then
.Edit
strSQL = "Select WhatsNewID From tblWhatsNew Where DateAdded >= #" & !LastLoginDate & "#"
Set rstWhatsNew = CurrentDb.OpenRecordset(strSQL)
While Not rstWhatsNew.EOF
DoCmd.OpenForm "frmWhatsNew", , , , , acDialog, rstWhatsNew!WhatsNewID
rstWhatsNew.MoveNext
Wend
rstWhatsNew.Close
Set rstWhatsNew = Nothing
Else
.AddNew
!UserName = GetCurrentUserName()
End If
!LastLoginDate = Now()
!IsLoggedIn = -1
Me.txtLastLoginID = !LastLoginID
.Update
.Close
End With
Set rst = Nothing
DoCmd.OpenForm "frmPrivacyNote"
Debug.Print Me.txtLastLoginID
End If
I need to track the username, so if GetCurrentUserName() is outdated, what is the current syntax?
Further follow up. I could not find data on Bing for GetCurrentUserName(), for good reason. It is a function within a MOD, so I need to figure out why the MOD is not getting called, or is malfunctioning.
After further delving, I found a Referenced MDB that has another function created by one of our users that is the cause of this error.
This is currently not an issue of MS Access working incorrectly. It is an issue with user created code.
GetCurrentUserName() is not defined by Access, so you should have looked at (and posted) its code.
If you are looking for the Windows user name, use this function:
Public Function GetUserName() As String
' GetUserName = Environ("USERNAME")
' Environ("USERNAME") is easily spoofed, see comment by HansUp
GetUserName = CreateObject("WScript.Network").UserName
End Function
Source
The link below would suggest that
CurrentUser()
is the function
CurrentUser()
Andre, thank you very much for the insight! I found this link:
http://www.codeproject.com/Articles/1422/Getting-User-Information-Using-WSH-and-VBScript
Dim objNet
On Error Resume Next
'In case we fail to create object then display our custom error
Set objNet = CreateObject("WScript.NetWork")
If Err.Number <> 0 Then 'If error occured then display notice
MsgBox "Don't be Shy." & vbCRLF &_
"Do not press ""No"" If your browser warns you."
Document.Location = "UserInfo.html"
'Place the Name of the document.
'It will display again
End If
Dim strInfo
strInfo = "User Name is " & objNet.UserName & vbCrLf & _
"Computer Name is " & objNet.ComputerName & vbCrLf & _
"Domain Name is " & objNet.UserDomain
MsgBox strInfo
Set objNet = Nothing 'Destroy the Object to free the Memory
I have a web app with a form that I am trying to pass to an ASP.NET server (using VB.NET) and then on to a MS SQL Server table. The form uses a jQuery datepicker in several textboxes and formats them as MM/dd/yyyy. The form fields are then passed through a PageMethod to the web server which takes the various field values and combines them into a SQL UPDATE command.
I am constantly getting the following error whenever I try to execute the SQL command:
Conversion failed when converting date and/or time from character string.
Here is the code on the server:
Using myConn As New System.Data.SqlClient.SqlConnection(CString.ConnectionString)
myConn.Open()
Dim cmd As New System.Data.SqlClient.SqlCommand("UPDATE table " & _
"SET type = '" & type & "', " & _
"target = '" & "#target" & "', " & _
"patient = '" & patient & "', " & _
"dob = '" & "#dob" & "' " & _
"WHERE serial = '" & serial & "'", myConn)
cmd.Parameters.Add(SqlParameter("#target", Data.SqlDbType.Date))
cmd.Parameters.Add(SqlParameter("#dob", Data.SqlDbType.Date))
If target = "" Then
cmd.Parameters("#target").Value = Data.SqlTypes.SqlDateTime.Null
Else
cmd.Parameters("#target").Value = target
End If
If dob = "" Then
cmd.Parameters("#dob").Value = Data.SqlTypes.SqlDateTime.Null
Else
cmd.Parameters("#dob").Value = dob
End If
cmd.ExecuteNonQuery()
End Using
Note: I've tried about twenty different ways of parsing the dates, converting them to dates, changing around the formats and none of it has worked.
Note 2: The conditional statements at the end are simply to prevent empty date fields from being stored in the SQL DB as "1/1/1900", but rather as an actual SQL NULL value. From debugging though, it seems that this is not the issue - it is when there is an actual value that the error is fired.
If anyone can see what I'm doing wrong and how I might fix it, it would be greatly appreciated. Thanks in advance for your help!
You are mixing up your parameterized and non-parameterized parts (why aren't you parameterizing everything?)
Dim cmd As New System.Data.SqlClient.SqlCommand("UPDATE table " & _
"SET type = '" & type & "', " & _
"target = #target, " & _
"patient = '" & patient & "', " & _
"dob = #dob " & _
"WHERE serial = '" & serial & "'", myConn)
Are you including time? DateTime fields require date and time.
I am interfacing with Quality Centre via Open Test Architecture API.
I would like to determined the allowed values of bug Fields that are linked to a lookup table.
These are available via drop downs in the standard frontend.
Thanks
Edit: A more Detailed explanation
We have some fields which will only allow specific values to placed in them.
For example:
NextAction can be one of the following { "1. Specify", "2. Analysis", "3. Design" }
But I have been unable to find a way to determine these allowed values programmatically.
Using the BugFactory object you can access the fields and their attributes. This is a direct copy / paste of Visual Basic from the OTA API Reference help file. If you want more help, try providing a more focused question, such as what you're trying to accomplish, which fields, and which language you're trying to access with.
Public Sub CheckValidValue(Optional TableName As String = "BUG")
Dim BugFact As BugFactory
Dim BugList As list
Dim aField As TDField
Dim fieldList As list
Dim rc, ErrCode As Long
Dim aBug As Bug
Dim msg$
Dim okCnt%, noNodeCnt%, errorCnt%, unknownCnt%
Dim dataType As Long
'------------------------------------------------
' User BugFactory.Fields to get a list of TDField
' objects in the bug table.
' This example uses the BugFactory, but this can
' be done with any class that implements IBaseFactory
'tdc is the global TDConnection object.
Set BugFact = tdc.BugFactory
Set fieldList = BugFact.Fields
'------------------------------------------
' Use List.Count to check how many items.
Debug.Print: Debug.Print
Debug.Print "There are " & fieldList.Count & _
" fields in this table."
Debug.Print "----------------------------------"
'Get any bug. To look at field attributes we
' need a valid object and since this example is
' not interested in the particular values of the object,
' it doesn't matter which bug.
Set BugList = BugFact.NewList("")
Set aBug = BugList(0)
'Walk through the list
For Each aField In fieldList
With aField
'Quit when we have enough for this example
If InStr(aField.Name, "BG_USER_10") > 0 Then Exit For
' For the DataTypeString() code,
' see example "Convert data types to string"
Debug.Print .Name & ", " & .Property & ", Data type is " _
& DataTypeString(.Type)
On Error Resume Next
'----------------------------------------------------
'Use TDField.IsValidValue to confirm that a value can
'be used for a field.
' Get the correct data type and check validity of an
' arbitrary value.
' Save the error code immediately after IsValidValue call
' before another call can change the err object.
dataType = aField.Type
Select Case dataType
Case TDOLE_LONG, TDOLE_ULONG
aField.IsValidValue 5, aBug
ErrCode = err.Number
Case TDOLE_FLOAT
aField.IsValidValue 5.5, aBug
ErrCode = err.Number
Case TDOLE_STRING
aField.IsValidValue "Joe", aBug
ErrCode = err.Number
Case Else
'These will be errors:
aField.IsValidValue _
"String to non-string value", aBug
ErrCode = err.Number
End Select
'Output an error code message
If ErrCode = 0 Then 'S_OK
msg = "Valid Value"
okCnt = okCnt + 1
Else
rc = ErrCode - vbObjectError
Select Case rc
Case FIELD_E_VERIFIED
msg = "Error: Invalid value for field"
errorCnt = errorCnt + 1
Case TDOLE_NONODE
msg = "Error: Field can not be set to this value"
noNodeCnt = noNodeCnt + 1
Case Else
msg = "Unrecognized error: " & rc _
& " , HRESULT = " & ErrCode
unknownCnt = unknownCnt + 1
End Select
End If
Debug.Print vbTab & msg
'
End With 'aField
Next aField
Debug.Print "----------------------------------"
Debug.Print "Number of fields with valid value = " & okCnt
Debug.Print "Number of fields with invalid type = " & errorCnt
Debug.Print "Number of fields with invalid value= " & noNodeCnt
Debug.Print "Number of fields with unknown error = " & unknownCnt
Debug.Print "----------------------------------"
End Sub
You can do this by looking up the list from the 'Customization' object. Here's how I'd do it using ruby:
qc = WIN32OLE.new('TDApiOle80.TDConnection')
qcserver = 'http://testdirector/qcbin/'
qc.InitConnectionEx(qcserver)
qc.Login($username, $password)
qc.Connect("$domain", "$project")
customization = #qc.Customization
list = custom.Lists.List("NextAction")
node = list.RootNode
children = node.Children
children.each do |child|
puts "#{child.Name} \n"
end
My code in asp classic, doing a mssql database query:
rs.pagesize = 1000 ' this should enable paging
rs.maxrecords = 0 ' 0 = unlimited maxrecords
response.write "hello world 1<br>"
rs.open strSql, conn
response.write "hello world 2<br>"
My output when there are fewer than 1000 rows returned is good. More than 1000 rows and I don't get the "hello world 2".
I thought that setting pagesize sets up paging and thus allows all rows to be returned regardless of how many rows there are. Without setting pagesize, paging is not enable and the limit is 1000 rows. However my page is acting as if pagesize is not working at all.
Please advise.
is it possible you are declaring your oRS.pagesize before you are opening the recordset?
Here is a good example of paging using getrows...
<!--VB ADO Constants file. Needed for the ad... constants we use-->
<!-- #include file="adovbs.inc" -->
<%
' BEGIN USER CONSTANTS
Dim CONN_STRING
Dim CONN_USER
Dim CONN_PASS
' I'm using a DSN-less connection.
' To use a DSN, the format is shown on the next line:
'CONN_STRING = "DSN=DSNName;"
CONN_STRING = "DBQ=" & Server.MapPath("database.mdb") & ";"
CONN_STRING = CONN_STRING & "Driver={Microsoft Access Driver (*.mdb)};"
' This DB is unsecured, o/w you'd need to specify something here
CONN_USER = ""
CONN_PASS = ""
' Our SQL code - overriding values we just set
' Comment out to use Access
CONN_STRING = "Provider=SQLOLEDB;Data Source=10.2.2.133;" _
& "Initial Catalog=samples;Connect Timeout=15;" _
& "Network Library=dbmssocn;"
CONN_USER = "samples"
CONN_PASS = "password"
' END USER CONSTANTS
' BEGIN RUNTIME CODE
' Declare our vars
Dim iPageSize 'How big our pages are
Dim iPageCount 'The number of pages we get back
Dim iPageCurrent 'The page we want to show
Dim strOrderBy 'A fake parameter used to illustrate passing them
Dim strSQL 'SQL command to execute
Dim objPagingConn 'The ADODB connection object
Dim objPagingRS 'The ADODB recordset object
Dim iRecordsShown 'Loop controller for displaying just iPageSize records
Dim I 'Standard looping var
' Get parameters
iPageSize = 10 ' You could easily allow users to change this
' Retrieve page to show or default to 1
If Request.QueryString("page") = "" Then
iPageCurrent = 1
Else
iPageCurrent = CInt(Request.QueryString("page"))
End If
' If you're doing this script with a search or something
' you'll need to pass the sql from page to page. I'm just
' paging through the entire table so I just hard coded it.
' What you show is irrelevant to the point of the sample.
'strSQL = "SELECT * FROM sample ORDER BY id;"
' Sept 30, 1999: Code Change
' Based on the non stop questions about how to pass parameters
' from page to page, I'm implementing it so I can stop answering
' the question of how to do it. I personally think this should
' be done based on the specific situation and is clearer if done
' in the same method on all pages, but it's really up to you.
' I'm going to be passing the ORDER BY parameter for illustration.
' This is where you read in parameters you'll need for your query.
' Read in order or default to id
'If Request.QueryString("order") = "" Then
' strOrderBy = "id"
'Else
' strOrderBy = Replace(Request.QueryString("order"), "'", "''")
'End If
' Make sure the input is one of our fields.
strOrderBy = LCase(Request.QueryString("order"))
Select Case strOrderBy
Case "last_name", "first_name", "sales"
' A little pointless, but...
strOrderBy = strOrderBy
Case Else
strOrderBy = "id"
End Select
' Build our SQL String using the parameters we just got.
strSQL = "SELECT * FROM sample ORDER BY " & strOrderBy & ";"
' Some lines I used while writing to debug... uh "test", yeah that's it!
' Left them FYI.
'strSQL = "SELECT * FROM sample WHERE id=1234 ORDER BY id;"
'strSQL = "SELECT * FROM sample;"
'Response.Write "SQL Query: " & strSQL & "<BR>" & vbCrLf
' Now we finally get to the DB work...
' Create and open our connection
Set objPagingConn = Server.CreateObject("ADODB.Connection")
objPagingConn.Open CONN_STRING, CONN_USER, CONN_PASS
' Create recordset and set the page size
Set objPagingRS = Server.CreateObject("ADODB.Recordset")
objPagingRS.PageSize = iPageSize
' You can change other settings as with any RS
'objPagingRS.CursorLocation = adUseClient
objPagingRS.CacheSize = iPageSize
' Open RS
objPagingRS.Open strSQL, objPagingConn, adOpenStatic, adLockReadOnly, adCmdText
' Get the count of the pages using the given page size
iPageCount = objPagingRS.PageCount
' If the request page falls outside the acceptable range,
' give them the closest match (1 or max)
If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
If iPageCurrent < 1 Then iPageCurrent = 1
' Check page count to prevent bombing when zero results are returned!
If iPageCount = 0 Then
Response.Write "No records found!"
Else
' Move to the selected page
objPagingRS.AbsolutePage = iPageCurrent
' Start output with a page x of n line
%>
<p>
<font size="+1">Page <strong><%= iPageCurrent %></strong>
of <strong><%= iPageCount %></strong></font>
</p>
<%
' Spacing
Response.Write vbCrLf
' Continue with a title row in our table
Response.Write "<table border=""1"">" & vbCrLf
' Show field names in the top row
Response.Write vbTab & "<tr>" & vbCrLf
For I = 0 To objPagingRS.Fields.Count - 1
Response.Write vbTab & vbTab & "<th>"
Response.Write objPagingRS.Fields(I).Name
Response.Write "</th>" & vbCrLf
Next 'I
Response.Write vbTab & "</tr>" & vbCrLf
' Loop through our records and ouput 1 row per record
iRecordsShown = 0
Do While iRecordsShown < iPageSize And Not objPagingRS.EOF
Response.Write vbTab & "<tr>" & vbCrLf
For I = 0 To objPagingRS.Fields.Count - 1
Response.Write vbTab & vbTab & "<td>"
Response.Write objPagingRS.Fields(I)
Response.Write "</td>" & vbCrLf
Next 'I
Response.Write vbTab & "</tr>" & vbCrLf
' Increment the number of records we've shown
iRecordsShown = iRecordsShown + 1
' Can't forget to move to the next record!
objPagingRS.MoveNext
Loop
' All done - close table
Response.Write "</table>" & vbCrLf
End If
' Close DB objects and free variables
objPagingRS.Close
Set objPagingRS = Nothing
objPagingConn.Close
Set objPagingConn = Nothing
' Show "previous" and "next" page links which pass the page to view
' and any parameters needed to rebuild the query. You could just as
' easily use a form but you'll need to change the lines that read
' the info back in at the top of the script.
If iPageCurrent > 1 Then
%>
[<< Prev]
<%
End If
' You can also show page numbers:
For I = 1 To iPageCount
If I = iPageCurrent Then
%>
<%= I %>
<%
Else
%>
<%= I %>
<%
End If
Next 'I
If iPageCurrent < iPageCount Then
%>
[Next >>]
<%
End If
' END RUNTIME CODE
%>
Try changing your rs.open line to:
rs.Open strSQL, Conn, 3, 1, &H0001
Here's the breakdown of the function call and parameters:
recordsetobject.Open Source, ActiveConnection, CursorType, LockType, Options
3 - adOpenStatic
1 - adLockReadOnly
&H0001 - adCmdText
I pull this from some old code of mine. I don't remember why this combination of parameters is necessary but it's what is necessary to implement paging.
Unlimited records sounds great but I would set a limit even if it's quite hi.
If you are not getting the "Hello World 2" output, is there an error? That would be helpful as well.
paging is for just that, paging.
your code here is not enough to accomplish that but regardless of the code, why are you trying to return a 1000 rows of data ????
nobody's going to read a 1000 rows of data and it will likely be very slow performance.
Using the following code, I returned 4000+ rows from a sql server table in classic ASP. It's not using the same method, but it doesn't suffer the limitations either.
strconnect = "DRIVER={SQL Server};SERVER=****;DATABASE=****;UID=****;PWD=****"
set conn=server.createobject("adodb.connection")
conn.open strconnect
set rs = conn.execute("select firstname from users")
if not rs.eof then
f_Array = rs.getrows
end if
rs.close
set rs = nothing
conn.close
set conn = nothing
for x = 0 to ubound(f_Array, 2)
response.write (x+1) & ". " & f_Array(0,x) & "<br />"
next
Previous question which links onto this and has any addition code ref should I forget to link any, I have set it up to email me should someone submit this form and an error occur and right now should that occur for most integer or datetime fields if they fail to validate then it will show me which fields in the email failed and what was input into them.
Problem I'm having now is to validate the drop downs and the textboxs in a similar way to what I with integer and datetime fields so I can display those also in the email in case they error.
present integer and datetime validation
Catch ex As Exception
lblInformation.Text = ("<h4>Unable to save data in database</h4>" + vbNewLine + "The error was '" + ex.Message + "'" + vbNewLine + vbNewLine + vbNewLine + "The SQL Command which falied was:" + vbNewLine + "<strong>" + mySQL + "</strong>" + vbNewLine).Replace(vbNewLine, "<br />" + vbNewLine)
Dim dtb As DateTime
If Not DateTime.TryParse(DateOfBirth, dtb) Then
strEMessageBody.Append("<strong>Date Of Birth:</strong> " & DateOfBirthYear.SelectedItem.Value & "-" & DateOfBirthMonth.SelectedItem.Value & "-" & DateOfBirthDay.SelectedItem.Value & vbCrLf)
strEMessageBody.Append("<br/>" & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab)
End If
Dim iao As Integer
If Not Integer.TryParse(AnyOther, iao) Then
strEMessageBody.Append("<strong>Any Other:</strong> " & rblAnyOther.Text & vbCrLf)
strEMessageBody.Append("<br/>" & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab)
End If
then below the final validation I have the Dim for the email setting but that I sorted out in the other question.
The problem is much earlier in the page I have
Sub Upload_Click(ByVal source As Object, ByVal e As EventArgs)
If (Page.IsValid) Then
Dim Name As String
Which prevents me just using there names as shown above where I would instead call them something else but that doesn't work with strings so my main issue is having some bit of code to check if the strings are valid and for the dropdowns which would either work but always show the data in the email or would hiccup in the code,
Dim imd As Integer
If Not Integer.TryParse(dept, imd) Then
strEMessageBody.Append("<strong>Department:</strong> " & dept.Text & vbCrLf)
strEMessageBody.Append("<br/>" & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab)
End If
below was how it had been setup to record the department
Department = dept.SelectedItem.Value
Department = Replace(Department, "'", "''")
Summary:- Need vb code to validate if strings and dropdowns are valid and the use of try/catch block is another possible solution but I wasn't able to figure out how to implement validation for that either.
Log your values into your database. Setup a logging table called "tblLog" or something else. Record the value of ex.Message or possibly even InnerException (if it exists).
Going hand in hand with Matt's answer, there is a tool that can help you with automatically logging errors to a DB.
It's called ELMAH.
EDIT
Here are 2 validations that you might want to use:
Dim s As String = "some user input in here"
If [String].IsNullOrEmpty(s) Then
' Watch out, string is null or it is an empty string
End If
Dim cb As New ComboBox()
If cb.SelectedItem Is Nothing Then
' Watch out, combo has no item selected
End If
NOTE ComboBox is a WinForm control in this example, but the idea is the same for the ASP.NET counterpart
Since everybodies given up trying to find a solution then I'm just gona close this topic with this post as the answer.