i have created forms which use queries to manipulate and show data, these queries have [criteria] which is taken from a combo box \ text field in the form.
it runs perfectly when i execute the form alone, however when executing it from the MainNavigationForm (tabbed navigation style) it pops-up the "enter criteria" dialog that you usually get when you specify a criteria without any source - like empty brackets [].
i am posting the VB code behind both forms, both behave the same way, and pop the dialog for criteria when launching them from the main navigation form, the first form has more code because it updates the query and values in another combo box based on the value of the first combo box. the second form just runs the query again when value in the combo box is changed.
thank you for your help.
Option Compare Database
Private Sub Command23_Click()
DoCmd.OpenQuery "QryMaintProgPlan", acViewNormal
End Sub
Private Sub id_combo_AfterUpdate()
DoCmd.ShowAllRecords
DoCmd.FindRecord Me!id_combo
Me.maint_combo.Requery
Me.emp_combo.Requery
End Sub
Private Sub maint_combo_AfterUpdate()
Me.emp_combo.Requery
Me.EmployeeID = emp_combo.ItemData(0)
End Sub
2nd form :
Option Compare Database
Private Sub btn_requery_Click()
DoCmd.ShowAllRecords
End Sub
Ok, i have found the answer, i was supposed to use the adress of the navigationSubform in the query criteria because once i launched it from the navigationForm it no longer used the same adress. [Forms]![frmMainNavigation]![NavigationSubform]![id_combo] is the correct one
instead of [Forms]![frmMaintProgPlan]![id_combo].
Related
I'm running a user defined script that changes the view during the course of its computations. When I launch the VBA script, the view is in no particular filter, table or view name. I want to restore the view just as it was before the user launched the script including which task has the focus. It seems like naming the view as the first step when the script launches and saving the task which has focus then activating the view and focus at the completion of the script is a potential way to do this but I'm not having any success. I would delete the named view at the end of running the script. Any suggestions or point me to previous discussions on this forum that may have answered; my search didn't reveal any.
Rod Gill suggested the following but unless I'm doing something wrong it doesn't appear to work.
Dim OrgnlID As Long
Dim OrgnlView As String
Dim OrgnlTable As String
Dim OrgnlFilter As String
OrgnlView = ActiveProject.CurrentView
OrgnlTable = ActiveProject.CurrentTable
OrgnlFilter = ActiveProject.CurrentFilter
OrgnlID = ActiveCell.Issue
' place your code here that does the view manipulations
' followed by the lines below to restore the view before manipulations
ViewApply OrgnlView
TableApply OrgnlTable
FilterApply OrgnlFilter
EditGoTo ID:=OrgnlID
I am migrating several adp files to accdb so that it can work under access 2013 but one problem is driving me nuts:
I have a form on which I cannot see an empty line to add new data.
the form property allowaddition is on
the recordsource of the form is an sql View to which I can add a new line directly from access (so it is not readonly)
I am forcing the AllowAddition on the code when initializing security with me.allowadditions = true (this used to be enough to make it work in the old adp)
I have a button to add a new line to the form that runs on_click and gives me a runtime error on this line of code Docmd.gotorecord , , AcNewRec
The runtime error is "2105 : you can't go to the specified record".
This tells me that there is something that is still read only.
the SQL View has an index as well as all the table used in it.
I tried to replace the view in the recordset of the form by a table and still not working.
Am I missing something? What else can I do to be able to add a new record to my form (or view)?
Thank you
Try setting focus to one of the textbox controls in your form before calling the new record, something along the lines of
me.txtControl.SetFocus
The reason is, SQL Server backend allocates new records differently than Access backend, and Access does a bit of magic for you in the interface, so I've found sometimes explicitly setting focus to a text control will fix this issue.
Depending on how things are structured with your Access app, if that suggestion doesn't work, then you might need to go the extra step of programatically creating the new record (blank fields except for primary key) in SQL Server first and then refresh the Access form and then setfocus to the newly created record (e.g. either the last or first record depending on your recordsource sort order)
I want to open a button named 'Open' in IE window using VBScript. Source code is like this:
<a title="Devtems Life Menu" href="javascript:OpenOryx('cboClone');">Open</a>
Before I start answering the question, I just want to say that I am by no means an expert at VBScript. My knowledge is based off a lot of messing around with it during weekends and a bit of read the documentation. There may be better ways of doing things, but this works for me.
My recommendation is if you have access to the html, add an attribute to your link so it looks something like this:
<a title="Devtems Life Menu" href="javascript:OpenOryx('cboClone');" id="openMenu">Open</a>
Then you can easily reference it in your code. If you can't access the html, then you may have to use a more roundabout way of checking the contents of each link. The actual syntax is described below in a little script I constructed. It firstly loads w3schools.com, then clicks on the references tab. This uses ie.document.getElementById(arg). Notice that the references navigation panel opens. After that it will prompt you to click the ok button to continue. It will then load google.com, and look through all the <a> tags. If it contains Open it clicks on it. You can use the same syntax, except different details for your script.
' Create the ie object
set ie = createobject("internetexplorer.application")
' Navigate to wherever you want
ie.navigate("http://www.w3schools.com/")
ie.Visible = true
' Call the subroutine we define below
waitForPage(ie)
' Get link by id
' This is a one liner, and I personally think is better than the method below
' first of all you get the tag you want by id
' then you click it
ie.document.getElementById("navbtn_references").click()
' call ie.document.parentWindow.execScript("w3_open_nav('references')", "JavaScript")
' could also be written as:
'set buttonElement = ie.document.getElementById("navbtn_references")
'buttonElement.click()
MsgBox("Click ok to continue to google.")
' Load google
ie.navigate("https://google.com/")
' And wait for it to load
waitForPage(ie)
' Click on a link by attribute (same technique can be used for name etc)
' Get all elements with tag input
set linkElements = ie.document.getElementsByTagName("a")
' Then loop through them
for each possibleElement in linkElements
' If it has a certain name..
if possibleElement.innerHtml = "About" then ' You could use If possibleElement.getAttribute("name") = "foo" Then or possibleElement.getAttribute("class") = "bar"
' Click it!
possibleElement.click()
end if
next
' Subroutine to wait for internet explorer to load a page
sub waitForPage(ie)
do
WScript.Sleep(100)
loop while ie.ReadyState < 4
end sub
Another method is rather than actually finding and clicking on the link, you simply run the script that is run when a user normally clicks on a link. In your case, it could mean running javascript:OpenOryx('cboClone'); directly. Here is how to run javascript code in VBScrpt:
call ie.document.parentWindow.execScript("javascript:OpenOryx('cboClone');", "JavaScript")
I hope that at least one of these methods helps you in writing your script.
I want to use Report Viewer in my project.
i have
1. CustomerDetails - Stored Procedure
2. CustomerDataset.xsd - in which i dragged n dropped the stored procedure.
3. CustomerReport.rdlc - in which i have crated a table which and data set is
CustomerDetails
4. CustomerReportViewer.aspx - in which the CustomerReoprt.rdlc is being binded.
now, i want to pass 2 values "chkeckInDate" and "checkOutDate" from 2 text box which are to be filled by use from "main.aspx" also i 'm calling my stored procedure from this file .
the report viewer is getting displayed but, the contents are not getting displayed (i have executed my stored procedure and it is running perfectly.)
How can i fix it? please help.
I didn't clearly understand where is the mistake, but I think you have the code under page_load event. Copy the code into button_click.
This is what I've used..
You must inport this:
Imports Microsoft.Reporting.WinForms
You should pass the textbox value as parameter.
Dim yr As New ReportParameter("param1", TextBox1.Text)
Try
Me.your_TableAdapter.Fill(Me.DataSet_name.table_name)
ReportViewer1.LocalReport.SetParameters(New ReportParameter() {yr})
Me.ReportViewer1.RefreshReport()
Catch ex As Exception
MsgBox("try again")
End Try
copy these two lines from page_load event into button_click.
Me.your_TableAdapter.Fill(Me.DataSet_name.table_name)
Me.ReportViewer1.RefreshReport()
Further, watch this
I've recently changed the rowheight for our grid and reduced it a bit (using code from http://www.devexpress.com/Support/Center/KB/p/A859.aspx).
However this breaks our RepositoryItemImageComboBox, the images are no longer shown.
Using a RepositoryItemPictureEdit with an unbound column I can't seem to find how to create a working row filter/row sort.
Who can help me either fix the RepositoryItemImageComboBox images to show again or implement a filtering/sorting RepositoryItemPictureEdit.
This is the column shown with RepositoryItemPictureEdit, No image data on the filterrow is also a problem
This is the column shown with a RepositoryItemImageComboBox.
I've added some code to handle the GridViews CustomDrawCell with no Editor specified. Since we don't really need the editor to choose but show the column read only it suffices.
Private Sub gvw_CustomDrawCell(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs) Handles Me.CustomDrawCell
e.Graphics.DrawImage(BitMap, e.Bounds);
end sub