I want to upload a file to a website. When I click the upload button, then a pop-up window with the document explorer opens and I want UFT to select the file from this pop-up window.
This is my code:
Option Explicit
Dim objType, value, bcName
objType = "File"
value = "Dialog select"
bcName = objType & " " & value
Dim pDoit, pKommentar, pMyFile, pMyFolder
pDoit = CBool(evalVarAndOffset(Parameter("doit")))
If pDoit = True Then
getUserTempFolder
pKommentar = Parameter("Kommentar")
pMyFolder = evalVarAndOffset(Parameter("Ordner"))
pMyFile = replaceUnwantedCharsFromString(evalVarAndOffset(Parameter("Datei")))
Window("Profil 1 - Microsoft Edge").Dialog("Öffnen").Activate
Window("Profil 1 - Microsoft Edge").Dialog("Öffnen").WinEdit("Dateiname:").Set pMyFolder &
pMyFile
Window("Profil 1 - Microsoft Edge").Dialog("Öffnen").WinButton("Öffnen").Click
SQS_ReportEvent micPass, "BC '" & bcName & "' ausgeführt. Datei: " & pMyFile, "Datei: " &
pMyFile
Else
SQS_ReportEvent micPass, "BC '" & bcName & "' übersprungen.", "BC '" & bcName & "'
übersprungen."
End If
SQS_ReportEvent micDone, "BC '" & bcName & "' ausgeführt.", "BC '" & bcName & "' ausgeführt."
SQS_ActionFinish
The problem is that UFT isn't able to find the pop-up window named "Profil 1 - Microsoft Edge", although this is the name I find if I use the Object Identificator of UFT.
This is the error message I get:
The "Profil 1 - Microsoft Edge" Window object was not found in the Object Repository.
Check the Object Repository to confirm that the object exists or to find the correct name for the object.
Line (22): "Window("Profil 1 - Microsoft Edge").Dialog("Öffnen").Activate".
Tip: If the objects in your application have changed, the Maintenance Run Mode can
help you identify and update your steps and/or the objects in your repository.
Related
I'm creating a macro that pulls e-mail attachments into a folder to be opened and copied, which works 100% perfect when the subject name is predefined, i.e. never changes.
' this works
Set oOlInbFiltered = oOlInb.Items.Restrict("[Subject] = " & SubjectName)
However, when I try to instead restrict for a preset beginning, say every email begins with 'aaaaa', it causes an automation error with the code below:
' this doesnt
Set oOlInbFiltered = oOlInb.Items.Restrict("[Subject] like '" & PrefixName & "%'")
Any help?
Expected results: No error message, files in folder. Instead I receive
Run-time error '-2147352567 (800200009)': Automation error Exception Occurred.
Try to use the following code instead:
criteria = "#SQL=" & Chr(34) & "urn:schemas:httpmail:subject" & Chr(34) & " like '" & PrefixName & "%'"
Set oOlInbFiltered = oOlInb.Items.Restrict(criteria)
Environement : Oracle 11gR2 , ASP .Net, VB
Aim: need to append text string to an existing record.
Problem: When using the following
strSQL += "Update table_name SET "
strSQL += " JOB = '" & Trim(Me.txtjob.Text) & "',"
strSQL += " NAME = '" & Trim(Me.txtname.Text) & "',"
strSQL += " REMARK = REMARK || ' " & Trim(Me.txtremark.Text) & "'"
It appends the already existing data along with the new data to the new data.
Example:
Contents before SQL Execution: ABC
Contents to append: DEF
Result after execution : ABCABCDEF
expected result: ABCDEF
I tried to use a few permutations to get the right result but to no avail.
Any suggestions/resolution will be appreciated.
Okay, it seems that this was a rather straight forward solution which i ended up over complicating.
IN my case:
I was reading the record and displaying it in a text box.
What i ended up doing was :
just update the entire contents of the text box again to the record.
Thus overwriting the already existing contents along with the modified contents of the textbox.
strSQL += " DOC_LOCATION = '" & System.Web.HttpUtility.HtmlEncode(Trim(Me.txtremark.Text)) & (" Last Edit: ") & temp & " " & DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") & "'"
Since this was a rather simple application, this solution worked for me.
Just a headsup, I am quite new to relational databases so my question could be a simple fix.
Currently, I have a table with the following data.
ID(1 ,2,3,4,5)
Location(Canada, USA, Japan, Australia, Venezuela)
Count(4,6,2,91,23)
I created a form with a combobox and two text fields. The goal is that I want to be able to click the combobox, have it show all the ID's and when I click an ID, it autopopulates the other two text fields with the corresponding information. After googling a bit, I found a way to do is. Within the Event tab under "on Change" for the combobox, I wrote the these two lines of code.
Me.txtLocation = Me.cboID.Column(1)
Me.txtCount = Me.cboID.Column(2)
However, I also want to be able to edit this information once it has been autopopulated. The problem I'm having is that when I change any of the two textfields, it always edits the first records.
So for example, if I click ID #4, and I change the "Count", it will change the "Count" for the ID #1. Any idea of what I'm doing wrong?
P.S. (I have programming experience but not with VBA)
Thanks in advance!
EDIT:
Private Sub txtCount_AfterUpdate()
Dim strSQL As String
strSQL = "UPDATE aDuh SET Count = '" & Me.Count & "', Location = '" & Me.txtLocation & "' WHERE ID = " & Me.cboID & ""
DoCmd.RunSQL (strSQL)
End Sub
Private Sub txtLocation_AfterUpdate()
Dim strSQL As String
strSQL = "UPDATE aDuh SET Location = '" & Me.txtLocation & "', Count = '" & Me.txtCount & "' WHERE ID = " & Me.cboID & ""
DoCmd.RunSQL (strSQL)
End Sub
Don't bind your form to a table. Put a textbox on your form with it's Visible property set to False. In that textbox, put the value of your Primary Key field (which should be an AutoNumber field) Then when you update your record, pass an UPDATE SQL statement where you update your table based on the value of your Primary Key
Dim strSQL as String
strSQL = "UPDATE aDuh SET Location = '" & Me.txtLocation & "', Count = '" & Me.txtCount & "' WHERE ID = " & Me.cboID & ""
DoCmd.RunSQL (strSQL)
I am creating form in access in which i have to implement cascading combo boxes , data in lower combo box is dependent on its parent value selected by user. Here is form
on left side is structure of the table and on right side is form. Problem is I am getting error of data type mismatch , unable to understand why this is happening. In the afterupdate event of Diametre of Drill I am populating cutting speed . Whenever I press drop down of Cutting Speed "Datatype mismatch in criteria expression" occurs. Here is code of afterupdate event of Diametre of Drill
Private Sub cboDiameterDrilling_AfterUpdate()
cboCuttingSpeedDrilling.RowSource = "Select DISTINCT tblDrilling.cuttingSpeed " & _
"FROM tblDrilling " & _
`"WHERE tblDrilling.materials = '" & cboMaterialDrilling.Value & "' AND tblDrilling.diaOfDrill = '` `cboDiameterDrilling.Value ' " & _`
"ORDER BY tblDrilling.cuttingSpeed;"
End Sub
I think problem is in WHERE Clause . Any help would be greatly appreciated. Thank you
You've surrounded the reference to the object's value (cboDiameterDrilling.Value ) in single quotes.
AND tblDrilling.diaOfDrill = ' & cboDiameterDrilling.Value & "'"
Solution : AND tblDrilling.diaOfDrill = " & cboDiameterDrilling.Value & " " & _
I think you missed a ". Try:
Private Sub cboDiameterDrilling_AfterUpdate()
cboCuttingSpeedDrilling.RowSource = "Select DISTINCT tblDrilling.cuttingSpeed " & _
"FROM tblDrilling " & _
`"WHERE tblDrilling.materials = '" & cboMaterialDrilling.Value & "' AND tblDrilling.diaOfDrill = '" & cboDiameterDrilling.Value & "' " & _
"ORDER BY tblDrilling.cuttingSpeed;"
End Sub
i get error 0x800A5077, i try import CrystalActiveXReportViewerLib10 and CrystalReportsCommonObjectModelLib, but it still no work.
Call ReportConnection(CInspAuditList, "Pab_Prod")
CInspAuditList.ReportFileName = My.Application.Info.DirectoryPath & "\MAuditList.rpt"
Call SubReportConnection(CInspAuditList, "Pab_Prod")
CInspAuditList.set_ParameterFields(0, "mchno; " & frmMachine.machine & " ;true")
CInspAuditList.set_ParameterFields(1, "batch; " & CDbl(frmMachine.batch) - 1 & " ;true")
CInspAuditList.set_ParameterFields(2, "Points; " & InpStdPt & " ;true")
CInspAuditList.set_ParameterFields(3, "ovrpt; " & OvrPoints & " ;true")
CInspAuditList.Action = 1
the error occur when CInspAuditList.Action = 1
vb.net help me declare CInspAuditList as AxCrystal.AxCrystalReport
This is my function for connection:
Public Function ReportConnection(ByRef CrystalReport1 As AxCrystal.AxCrystalReport, ByRef dsnname As String) As Boolean
CrystalReport1.Connect = "dsn=" & dsnname & ";UID=" & gstrID & ";PWD=" & gstrPassword & ";DSQ="
End Function
I want to know the reason cause the error happen & my connection correct or not
That happened to me and that is because the report file (.rpt) contains a connection to a database that doesn't exists or cannot be located by the computer where you are running the program solution: open the report file (.rpt), menu database, verify database, checkout the parameters of the connection(mine is sql connection), ok, and you can see a msg that say the database is up to date, ok, save changes in report
If you ara using system dsn, crystal report needs admin rights for connect.
In the registry ODBC key is Local Machine and only grant Full Control to System and Administrators.