Im trying create a new form to add our current database that will password protect excel, word and if possible pdf documents when they are dragged onto it.
For now I only have 2 boxes 1 containing the password to be applied and the other to drag the file onto.
I have it all working so once its dragged on it works out if its a word doc, opens a hidden instance of word which then resaves it with a coded password.
The problem comes when change it so the user enters the password to protect it, when they enter a password or click on the drag box it doesn't allow the drag. it seems once they have entered the record the drag option is not available anymore.
I would like to type a value into a list box and then press a command button and have that value transfer to a list box for later use. I've been playing with the onclick event of my command button and this is what I have so far:
Code:
Option Compare Database Private Sub Command4_Click() List0.AddItem Text2.Text List0.ListIndex = List0.ListCount - 1 End Sub
When I click the button I get an error:
2185 - You can't reference a property or method for a control unless the control has the focus.
I have an Access 2010 database where we have a SQL Linked Table with a column that is nVARCHAR(20) Not Null data type. We have created a form for data entry. Currently when the user tries to erase a value or choose not to define a value we get the following error.
"You tried to assign the Null value to a variable that is not a Variant data type."
This field should accept a blank value "" as the user may not want to set the value. We do not have control over the DB schema, so how can I work around this issue in access?
I have a drop down box where I select a Retailer. When this choice is made I want the last invoice entry to appear in a text box. I have attempted this by creating a query which contains the top 1 invoice in descending order. My dropdown box Event updates a hidden List box using List677. Requery and List677 has a SELECT statement in Row Source
So far so good this bit works
I want to use this value as a default in a Textbox. I thought I could use the same trick to populate the Textbox as I did the Listbox so i tried Text232. Requery after the List677. Requery in the Event above. But no it does not update. The only time the textbox updates is if the Listbox is in Focus and as I said this List box is Hidden. How can I get the textbox to change in real time... I would use the Listbox but i need to be able to change the value of the contents to run reports, I just want a default value.
textBox Default Value: =[List677] textBox Control Source: =[List677]
List677 Row Source: SELECT LastInvoice.Invoice FROM LastInvoice;
Here's a link to a post with background (see the relationships image at the top): [URL] .....
So I got everything to work exactly as I wanted it to.. the listbox has its rowsrc manually changed via VB on form open or record change... so everytime the record changes or the form opens, VB creates a query string that pulls the TFE_Num and TFE_Name from the DB for only those records where the forms current key (me.key.value) equals the TFE_key values. And everything works.
The problem is that this VB based query is very slow... so everytime the record changes, we wait 1-5 seconds for this listbox to pull data and display it. My question is this: Is there a better way to do this, some way that doesn't require VB based SQL statement. I'm asking because all the non-listbox controls on the form use a control source and they get updated instantaniously on form open or record move, but the list boxes that are unbound and are populated using VB SQL are really slow... and there are really only 1 or 2 records ever displayed in the list box.
I have tried to set the rowsource for the list box within the properties tab and comment out the VB SQL code, but haven't succeeded. I suspect the issue is that the form is linked to all fields in the master table while the list box is linked to a 1st and 2nd generation child table... I just can't get it to work! I've tried simple adding the TFE tables and fields to the forms record source poperties, but when I do that I can only navigate to records that have TFEs associated with them.
I suspect I could resolve the issue myself, if only access queries allowed "me.key.value" to be used in the WHERE statement. Am I correct that you cannot do this in Accesses query builder or the SQL version? When I tried, it worked but then I notices the me.key.value got converted to a number (the first record) when it ran the first time.
hi, i have list box and the source coming form Query. i want when i click on one in list box want it will show [faults] field in textbox from query the field [faults] is a memo can someone help me __________________ David
I need to create a user interface that will allow a boolean type search of a field. This would mean item1 AND item2 AND NOT item 3, item1 or item2, item 1 NOT item2, etc.
I've set up a combo box setup with the following script, but I can't figure out how to adjust it to allow the multiples.
Please advise if I should adjust this or try a differenmt interface format for my users.
Option Compare Database 'Use database order for string comparisons Option Explicit
Private Function AfterCombo(WhichLine As Integer) Dim CBox As Control, TBox As Control, AndBox As Control, TBoxA As Control Set CBox = Me("Combo" & WhichLine) Set TBox = Me("Value" & WhichLine) Set AndBox = Me("And" & WhichLine) Set TBoxA = Me("Value" & WhichLine & "A") TBox = Null TBoxA = Null Select Case CBox Case "All", "Blank", "Not Blank" TBox.Visible = False AndBox.Visible = False TBoxA.Visible = False Case "Like", "Equal", "Less Than", "Greater Than", "Not Like", "Not Equal", "Not Less Than", "Not Greater Than", "In List", "Not In List" TBox.Visible = True AndBox.Visible = False TBoxA.Visible = False Case "Between", "Not Between" TBox.Visible = True AndBox.Visible = True TBoxA.Visible = True End Select End Function
Private Sub Cancel_Click() DoCmd.Close End Sub
Private Function FormatList(ByVal List As String, FieldType As Integer) Dim NewList As String, CommaPos As Integer, Word As String NewList = "" Do While Len(List) > 0 CommaPos = InStr(List, ",") If CommaPos = 0 Then Word = Trim(List) List = "" Else Word = Trim(Left(List, CommaPos - 1)) List = Trim(Mid(List, CommaPos + 1)) End If If Word > "" Then Select Case FieldType Case DB_TEXT, DB_MEMO If InStr(Word, """") > 0 Then MsgBox "Don't type double-quotes in the list" End End If Word = """" & Word & """" Case DB_DATE If InStr(Word, "#") > 0 Then MsgBox "Don't type '#' in your dates" End End If If Not IsDate(Word) Then MsgBox "Your list contains non-date characters" End End If Word = "#" & Word & "#" Case Else If Not IsNumeric(Word) Then MsgBox "Your list contains non-numeric characters" End End If End Select NewList = NewList & "," & Word End If Loop NewList = Mid(NewList, 2) If NewList = "" Then MsgBox "Your list needs a valid value" End End If FormatList = NewList End Function
Private Function MakeNull(C As Control) If Len(Trim(C)) < 1 Then C = Null End Function
Private Function MakeSQL(WhichLine As Integer, FieldName As String, FieldType As Integer) As Variant Dim CBox As Variant, TBox As Variant, TBoxA As Variant Dim Condition As Variant, Delim1 As String, Delim2 As String CBox = Me("Combo" & WhichLine) TBox = Me("Value" & WhichLine) TBoxA = Me("Value" & WhichLine & "A") Select Case CBox Case "Like", "Equal", "Less Than", "Greater Than", "In", "Not Like", "Not Equal", "Not Less Than", "Not Greater Than", "Not In" If IsNull(TBox) Then MsgBox "You have left a parameter blank for field [" & FieldName & "]" End End If Case "Between", "Not Between" If IsNull(TBox) Or IsNull(TBoxA) Then MsgBox "You have left a parameter blank for field [" & FieldName & "]" End End If End Select Select Case FieldType Case DB_TEXT, DB_MEMO Delim1 = """" Delim2 = """" If Not IsNull(TBox) Then TBox = QFix(TBox) If Not IsNull(TBoxA) Then TBoxA = QFix(TBoxA) Case DB_DATE Delim1 = "#" Delim2 = "#" Case Else Delim1 = "" Delim2 = "" End Select Select Case CBox Case "All" Condition = Null Case "Blank" Condition = " Is Null" Case "Not Blank" Condition = " Is Not Null" Case "Like" Condition = " Like """ & TBox & """" Case "Equal" Condition = "=" & Delim1 & TBox & Delim2 Case "Less Than" Condition = "<" & Delim1 & TBox & Delim2 Case "Greater Than" Condition = ">" & Delim1 & TBox & Delim2 Case "Not Like" Condition = " Not Like """ & TBox & """" Case "Not Equal" Condition = "<>" & Delim1 & TBox & Delim2 Case "Not Less Than" Condition = ">=" & Delim1 & TBox & Delim2 Case "Not Greater Than" Condition = "<=" & Delim1 & TBox & Delim2 Case "In List" Condition = " In(" & FormatList(TBox, FieldType) & ")" Case "Not In List" Condition = " Not In(" & FormatList(TBox, FieldType) & ")" Case "Between" Condition = " Between " & Delim1 & TBox & Delim2 & " And " & Delim1 & TBoxA & Delim2 Case "Not Between" Condition = " Not Between " & Delim1 & TBox & Delim2 & " And " & Delim1 & TBoxA & Delim2 End Select MakeSQL = " And [" + FieldName + "]" + Condition End Function
Private Sub OK_Click() Dim Where As String Const ObType = "Form" Where = Where & MakeSQL(1, "Lyrics", 10) Where = Where & MakeSQL(2, "TrackTitle", 10)
On Error GoTo OKCApplyError If Where <> "" Then Where = Mid(Where, 6) DoCmd.OpenForm "MasterFormQuery", , , Where Else DoCmd.OpenForm "MasterFormQuery" End If
Private Function QFix(ByVal X) Dim P As Integer If IsNull(X) Then QFix = Null Exit Function End If P = InStr(X, """") Do While P > 0 X = Left$(X, P) & """" & Mid$(X, P + 1) P = InStr(P + 2, X, """") Loop QFix = X End Function
Private Sub exitselectform_Click() On Error GoTo Err_exitselectform_Click
I am totally new to ms access form development. I have to construct a form with a text box a command button and listbox. listbox contains the list of items.I have populated the list box with the items in the tables.Now on the same page I have to add new item via text box and when click command button it should be added(all these thing I have done). Problem is that I have to do some thing like if a type any letter in the text box all listbox item are arrange like that like
If Items are abcd,aaaa,aabb, aa,abb,bba,bcd,bab I enter ba in the textbox then itme should be arrange like
In the past a Teacher would manually create a Form (Student Form) containing Student information, (Name, Gender, Birthdate, Homegroup) as well as additional issues on the student. This would all be saved into a table.
I would like to change this manual process of typing in individually to each text box, therefore, I have been able to run a report from a external program that obtains (Name, Gender, Birthdate, Homegroup). This saves as CSV and I am able to import into a separate table within the database. This works no problem.
What I have set-up is a form that contains a listbox this contains the Student name and Homegroup from the imported table contents. Again this works fine.
What i would like to do is when a student is selected from the listbox and dbl clicked on, how can i make information (Name, Gender, Birthdate, Homegroup) populate the textboxes in the Student form that the teacher previously used? could this be an update query where the imported table information will then go into the Student form? If so, how can I tell the dbl click of highlighted name is the data i want to populate?
I am trying to populate a textbox from a field in a table based on clicking on a item in a listbox. User clicks a name from the Client table in the client field, and the date that is stored in the orderDate in the same row. I want the text11 textbox to show that date.
I have several databases created and I am wondering if anyone knows of a way to have a textbox that would act as a search field instead of the Access pop up search that you get when searching a field. I would like to set it up that the search would be for Primary Key only. Is this possible or do you have to use the standard pop up search?
I am trying to get a button on my form to open two reports, and also go to a website. Once at the website I want it to type in a search bar based off of the criteria of the two reports. I currently have it able to open both reports correctly, and I can get the website to open, but I am not able to find a way to get access to type anything once on the website.
What i want is to have a combo box on a continuous form that as you type it filters the Query it is based on using a Like *. and drops downs so the user can see the updated list after each key press? Is this possible?
I have a bound combo box that has a query as a row source, The query has 3 fields called from tblMasterItems, The ItemID , ItemDesc and ItemSupplier(related to the PK of tblSupplier).
Column Count = 3 Column Width = 0";1";0"
If I do not put a criteria under ItemSupplier, the combo box behaves just fine. The problem happens when I set the criteria under ItemSupplier, the criteria being the supplier ID, the combo box no longer expands and searches as you type, but the items in the combo box have been filtered and are there.
Summary:
When the row source qry ItemSupplier Field does not have a criteria, cbo works just fine. When the row source qry ItemSupplier has a criteria, cbo no longer expands and searches as you type, but has the filtered data showing if you hit the expand button (that arrow pointing down in the cbo)
My form has a listbox (lstHeatTreatments - Multi-Select disabled) that displays Heat Treatment descriptions and an unbound textbox (txtHTDetails) that I would like to have display the corresponding memo field when a description is selected from the listbox.
This is my code so far:
Code: Private Sub lstHeatTreatments_AfterUpdate() Dim myConnection As ADODB.Connection Dim myRecordSet As New ADODB.Recordset Dim mySQL As String Dim selectedRequirementKey As Long Set myConnection = CurrentProject.AccessConnection Set myRecordSet.ActiveConnection = myConnection
Having an excruciatingly hard time seting up a txtBox and listBox to search records
ListBox, which contains an agency name should display all but filter out as user types in the textBox above. this listbox should allow a user to double-click to bring up record.
Will really appreciate the help! I have seen it being done on Access – and was wondering if anyone knows of a link or tip on setting this up!
I have successfully created a dynamic search form, which filters a listbox as the user is typing into a textbox.However, I am now trying to make the search more basic, which I cannot do. I want the listbox to be blank, and only display results where the number in the textbox matches one of the fields in the listbox.
Code:
Sub SearchFor() 'Create a string (text) variable Dim vSearchString As String 'Populate the string variable with the text entered in the Text Box SearchFor vSearchString = SearchForProp.Text
I have a quote form that has a button which opens a simple search form with just one textbox which gives the results in a subform. (the search is for the company name and the subform results give the company name with the full address (company, add1, add2, town, county, postcode)
I would like to have a button on the search form, to copy the correct result into a textbox on the quote.Until now I have just had a cmbox on the quote with the companies and addresses listed. Unfortunately, the users are not checking this list to see if the company already exists and are adding a new company but with slightly different information, so I am getting multi companies. (i.e, smith ltd, smith limited, or Hants, Hampshire etc).
I need a button on the main search form that copies the company name from the search results subform and copies it into a textbox on the quote.I have tried this on a button but it doesn't like it:
I'm using Access 2010, though am also familiar with Access 2007. I have a listbox populated with a query (concatenated last and first names with a bound ID field that's invisible). One of my users asked if it would be possible to search the listbox by more than the first letter of the name. As it stands now, if you type Smith, the focus would go to the first name starting with the letter "H", rather than Smith.
I've spent a lot of time researching this and come to the conclusion that this functionality does not exist within a listbox. However, I've discovered, a popular suggestion is to change the listbox to a combobox, which has this functionality. Since my listbox is multiselect, that would not work for me.
I have a search form that uses several comboboxes, textboxes and checkboxes that are used as criteria in a query. You enter in the relevant information, hit search and a report opens based on the filtered query.
What I would like to do is change one of these combo boxes to a listbox and use the multiple selection as the query criteria. I know it's not as simple as just putting the listbox as a criteria in the query, and I've also tried many different variations on the varItem and strWhere code.
How to create a search BUTTON to give results on the listbox after a user typing the desired keywords to search.
As of now, the database has "On Change" property that whenever a key is pressed (from time to time; letter per letter) it automatically change. What I want is for the user to finish the word he/she wanted to search then theres a Search BUTTON to press in order to show the results.
Attached is the database...
And also, how to put Reset BUTTON - to reset the search box and ready for the user to type again.
I have created a multi field search form that have 2 textbox and 2 multiselect listbox(extended). How to make the search form query correctly? Below are the details.
I also have a button that run the query qrySearchForm .how am I going to make the query run successfully with multiselect listbox ? I understand that there are a lot of examples of the vba code for multiselect but that is only for multiselect alone and not like my search form that combine textbox and multiselect listbox.