Show Text Box In A Form Based On Character Within A String In Another Text Box
Dec 21, 2012
I have a form where I want a textbox [txtMaxOrdLimit] to be visible only if another text box on the same form [PaNumber] contains the letter D in the string. This is the code I have on the forms On Current property but I'm missing something because textbox [txtMaxOrdLimit] doesn't show on the form at all.
If Me.PaNumber = "*D" Then
Me.txtMaxOrdLimit.Visible = True
Else
Me.txtMaxOrdLimit.Visible = False
End If
I have a file that I need to import on a regular basis. There are two different issues with the import:
1. the first digit in the file indicates if it is a record I want to keep. In this case a 1 indicates a repair record and an 8 indicates it is just information such as email, contact info etc.
2. I have a field in the file that may change the import specifications
For example:
If the record is a Non wheel repair then column 167 is a 50 character description If the record is Wheel repair then column 167 is a 28 character description and the remaining 22 characters are broken down into 10 different fields
So I need to do the following
1. Read the first character in the line and determine if it is a number 1 and if not discard it 2. Read a field in column 109 that is two characters long and if it says it is a wheel repair the import will break column 167 -216 down to the appropriate 11 fields and if it is a non wheel repair it will import columns 167 - 216 as one big description field.
I have used the import specifications with Access but it seems this will have to be done in code in a module or something and I am not very good with VB. (only know the basics)
One other issue is I have dates in the file that are 130225 and 1302 (so full date and then Year/Month) if i take out the / date separator in the import spec the full date works but the Year/Month doesn't.
I have a select query that holds anywhere between 1 to a couple hundred records, I need to take the Name field and populate a textbox which after verification I write to a text file that I later use in a powershell script. So far have tried using VBA to create a variable and populate the textbox based on the string but it only provides me the first item, I've tried dmax and this gives me a single result last Item, Dlookup only gives me the first item, changed it to a listbox which populates the box correctly but only writes the selected item in to my text file.
I have a form (employee info) that requires the user to do a search to find the employee before then editing anything that needs to be edited.
I have a search box that will find the relevant record without any problem, however what I am looking to do is hide text boxes on the form and have them appear only once the search has found the matching record.
If no matching record is found, I would then like a message box that states 'No matching employee, would you like to add an employee' and when the user clicks OK, it then reveals the same hidden text boxes and sets focus to the first one of the bunch.
Now, I have used the 'me.textboxname.visible = True (or False) elsewhere, however, I am not sure how to trigger that after a search.
I assume I am looking at an If statement, but I am not sure how to construct it, hence turning to the experts.
Code: Private Sub txtEmployeeSearch_AfterUpdate() If txtEmployee = DLookup("EmployeeNumber", "tblEmployeeInfo") Then Me.txtboxname.Visible = True Me.txtboxname2.Visible = True DoCmd.GoToControl "txtboxname" Else MsgBox "Employee Not Found", vbYesNo <<<<<<<<<<<<<<<<<<<<<< End If End Sub
I know that there is a massive gap where I have put <<<<<<<<<<<<<<<< - but I am stumped as to what to put in there?
Been a while since I put hands on access. Working with a very simple database.
Working with 1 table, 1 form, 1 query.
Query has several fields. Field of interest contains names of counties.
In query design view I can type, "CountyA" Or "CountyB" or "CountyC" in the criteria and the desired results are returned.
On form I've created a text box and an open report button. The report I'm trying to open uses the query as the data source. I reference the text box on the form as the criteria for the query as follows:
If I enter the the name of a single county into the form it executes perfectly. If I try to enter multiple counties it fails. This is true whether I just enter the county names or replicate the exact criteria string I use in the source query. For example
CountyA works and returns desired values for County A CountyA Or CountyB or CountyC fails. The report opens but no records are returned "CountyA" Or "CountyB" or "CountyC" = exactly how it is entered in the query if I'm not using the form opens report but no records are returned
How can I pass multiple values from a single text box to the query.
I've search the forums...If you can find a thread that discusses this, or can give me some advice on this topic, let me know.
Is there any built-in function that will allow me to delete any text before a certain point in a record... Or perhaps a way to use the REPLACE function to do so?
All of my records look like this (They're ticker symbols): AMZN:Amazon, Inc WMT:Wal-Mart Inc. A:Agilen Tech Inc MSFT:Microsoft Inc.
I just want the company name...Unfortunately, the ticker symbols aren't always the same length, so I can't use the left or right function.
I need to delete the colon and anything to the left of the colon. I've thought of a great use of the replace function for this purpose...I used wildcards...Too bad it didn't work!
Just The Company Name: Replace([Ticker Symbol and Name],"*" & ":","")
I have a form to capture client information. I would like to have the the first character of the name fields (First and Last) be automatically capitalized. How can I set the field to do this?
What can i put on a text box to limit the amount of characters entered like the 'field size' property for a table. I want to limit entry to 40 characters. Thanks in advance for any help,
i would like to make a query in ma access can extract text between first and second character "/" and when there are not "/" in field it returns null.now data in my table are like below
Quote:
No option1 1 100 2 145/Mechanical/0800 3 120/electrical/1620 4 131/mechanical/0200/dw-001
Now I like to make a query can extract text between first and second character "/" like below: No option1 discipline
I have a form and a text box. I wanna when open this form in the text box my pc processor id will show. I know i have to use form load event but i have not skill in vb.
I have a database that I imported as a comma deliminated csv file. To keep my original text comas intact I changed all the commas to semicolons before I created the csv file and imported the data. I now have a data base with semicolons in place of the original commas.
I am trying to use the update query function to change all the semicolons back to commas in one of the database fields called File_name
I have a data entry where a record in the File_name field looks like this for example
Chevrolet cavalier; red
and I want to change it so that it looks like
Chevrolet cavalier, red
I run an update query with the criteria set as Like "*;*"
and this finds all the records which have a semicolon in them
I have set the update field to "*,*"
but all this does is to change the record from
Chevrolet cavalier; red
to
*,*
Is the query update the way to go and what is the syntax that I should be using in the Update field just to change the semicolon to a comma and leave the other text intact?
I have a form containing 4 text Boxes txt1, txt2, txt3 and txt4
I want
txt1 show records from table empDetail having age between 18 to 25 txt2 show records from table empDetail having age between 26 to 35 txt3 show records from table empDetail having age between 36 to 45 txt4 show records from table empDetail having age between 46 to 55
I'm having trouble converting text to proper text in Access 2010 using Windows 8.1 as OS.
The message I keep getting is:
The expression you entered contains invalid syntax. You omitted an operand or operator, you entered an invalid character or comma, or you entered text without surrounding it in quotation marks.
I am using Access 2007. I recently converted my table field from text to memo. When I run a query and report linked to the qry the memo text is displayed as Chinese character or square box (if field is empty). In some forum posts this is shown as a font bug e.g. with Calibri. I changed from Calibri to Arial as this was reported to correct the bug. It did not work.
My field is set to Grow and Shrink, and table font is Rich Text also as mentioned in other posts. Still not working out.
Is it possible to have the value in a text box be set automatically based on the value in another textbox?For example, Textbox Gender is Male, so Textbox Reference is Male.
Code:
IFF Me.Gender = "Male" Then Me.Reference = "Male" And Me.ID = "ea13-02c" Else If Me.Gender = "Female" Me.Reference = "Female" And Me.ID = "ea13-01c" End If
I have one table containing name of restaurant with its address etc. Then i created another table to list out the restaurant workers names and details. Just as an example,
Table:Restaurant Restaurant name Address line 1 Address line 2 Restaurant # Website
Table:StaffContact Staff Role Name speciality email phone
I have the main form that has all the restaurant details only. And i have another form containing the Staff information. Please note the two table have a relation and it works well.
Now to make it user friendly(basically easier for the lazy ones), I dragged the staff contact form on to my main form and displayed it as a datasheet(basically a sub form).
Now, my boss does not want users to add/delete on this sub form(datasheet). So,he wants me to create buttons to open new record of staff for each restaurant(new form)
My issue is with opening a new record to enter a new person to the staff list and give them a role as well in form view.The new form has
So i ran a Macro, with open form with Where condition
I am very new at Microsoft Access. I have two forms, A and B, that are filled out by two different users. Form A gets filled out first than form B gets filled out. Each has a name box as well as a birthdate box and a few other similar text fields. However, each form also has a few distinctive fields. I was wondering how I could input the common information in Form A to Form B so the user of Form B does not have to spend time retyping the name and birthdates again. In other words, I want to synchronize the similar records between the two forms. I would like the values to appear in a table as well. I would greatly appreciate it if someone could help me with the visual basic code. Thank You.
I sure am having difficulty with this. I'm trying to have the criteria in my form refer to a text box within one of my forms which is the text as I would write it myself within the query design view.
[calcDestZip5]'s value in QueryWizard form = "55422" OR "55343"
Basically, I just want to be able to enter the text string within a form instead of within the query. Sure this can be done!
Oh, and for what it's worth... If, [calcDestZip5]'s value in QueryWizard form = "55422" Then the query runs just fine. It's as if the query doesn't want to accept multiple criteria from another source.
Hello, Could some kind person out there help me out please? I have been 'dabbling in' the area of conditional formatting, particularly in the area of changing the colour of my active form based on the result of what’s output on a text box. I have had some success in this area but where I am getting confused is getting the colour of my form to change on the basis of what is entered into a text box control that does not match exactly. My forms background changes to the required colour when its value is ‘set exactly’ but what I am trying to achieve is to change it according to the first letter of entry regardless of what follows? It always starts with a letter, either a ‘D’ or ‘V’ to indicate whether its ‘Vital’ or ‘Desirable’ and is subsequently followed by no more than 6 numbers and finally a letter. Basically I need my form to change colour based on the whether it is either a ‘V’ or a ‘D’ irrespective of what follows???
What I have been using so far is:
Private Sub Model_Number_AfterUpdate() If Me.Part_Number = "V111145K" Then Me.Section(acDetail).BackColor = 12632256 'Light Red Else Me.Section(acDetail).BackColor = 8421631 'Blah Gray End If End Sub
Private Sub Form_Current() If Me.Part_Number = "V111145K" Then Me.Section(acDetail).BackColor = 12632256 'Light Red Else Me.Section(acDetail).BackColor = 8421631 'Blah Gray End If End Sub
I'd lile to show/hide selected subforms based on the the text in a txtfield. The text in the selection field (txtSelect) I'd like to use for that may be either one of the following:
book-01, book-02, book-03 etc OR, folder-01, folder-02, folder-03 etc OR, record-01, record-02 record-03 etc. OR it can be just a 4 digit number.
If the txtSelect contains "book" I'd like the subfrmBookdetails to be visible. If the txtSelect contains "folder" obviously the subfrmFolderdetails etc.
What I'm struggling with is the If-Then statement for selecting the partial text in txtselect.
I've tried things like this: On current me.txtSelect.setfocus if me.txtSelect.text="book*" then me.subfrmBookdetails.visible=true etc etc.
No joy.
I know how to get this to work in a query with a like-statement but I have not been able to find anything on this in relation to conditional formatting of a form. Any one and good ideas?
I've got a field called [WordLink] on a form where the user enters the file name of the Word or Excel document asociated with the record.
I have a button that opens Word or Excel and then opens the file...not a problem there as I'm using the Call Shell("""C:Program Files command and that works just fine.
However, I need the button to look to see if it's got ".doc" or ".xls" within the text string in the field so it knows whether to open Word or Excel.
I've tried something basic to launch something like a msgbox (see code below) but obviously it doesn't work. How do I look within a text string for a value?
Cheers,
Russ :D
If Me.WordLink_filename.Value = "*.doc" Then MsgBox "This is a word file." Else End If