Trouble Highlighting Contents in text box


Hi,

I have a form containing a text box. People enter data to it and then tab out of it. I check it and if there is no problem the program does other things. If there is a problem, I alert the user with a message box and return focus to the original text box. I want the entire contents of the text box to be highlighted at this time. However, the cursor just positions itself in front of the first character. My code follows:

Private Sub InvoiceNo_AfterUpdate()
If Not InvoicePosted(Me.Invoice_Number) Then
Do stuff
Else
MsgBox "This invoice has aready been posted. Either unpost it or select another invoice."
Me.InvoiceNo.SetFocus
Me.InvoiceNo.SelStart = 0
Me.InvoiceNo.SelLength = Len(Me.InvoiceNo.text)
End If

I'm using Access 2002. Any ideas?

Thanks,

Mike


Sponsored Links:



Hi folks,

Does anybody know how to make your text boxes highlighted on mouse over it? I mean text boxes and not content in text boxes. I have seen it at "MOE", an add-in from Peter's Software. It looks pretty cool but unfortunately I don't know how to apply it in my forms.

Maybe you have some ideas...

Thanks




Am pretty new to access.

I have a form which has a combo box which controls the output to a text box and this in turn controls the items on a subform.

I wish to add a separate image box which is also controlled by the text box.

The text box could have one or many items and the image should reflect the highlighted item in the text box.

Need help with correct code.




I am attempting to have a contact name displayed in text box Branch_Contact. But the result depends on the selection made in the two previous combo boxes cboBranch_Name and cboBranch_City.

I have made a Query(branch Query) that displays the contact name when run by it self, but when inserted in the control source field for the text box it doesn't work. The query code is as follows:

Select branch_contact,branch_name,branch_city
from branch
group by branch_contact,branch_name,branch_city

Branch_name
criteria: [forms]![mainform]![cbobranch_name]
Branch_city
criteria:[forms]![mainform]![cbobranch_name]

Am i even on the right track? is there an easier way to do this?
You can tell i don't have a lot of experience with this, so any assistance would be great.






Hi,

I am using Query Design with MS Access 2007 to create a query for selecting/extracting a data set.

I make 2 text boxes named "Week From" & "Week To" on a form so that when I enter 2 numbers (but with Text type) in the text boxes and click a button running the query, I would get a selected data set for the specific period.

For example, when I enter "1" in "Week From" and 8 in "Week To", I should get the data set about the period from Week 1 to Week 8.

The problem is:
The data type of the corresponding fields in the table for "Week From" & "Week To" is Integer. So, I need to convert the 2 text boxes from Text to Integer or Number.

I try to use the function Cint (please see below) in the query, but get error message.
* =CInt([Forms]![Extract Data]![Week From])

Why? How to convert the Text values in Text Boxes and use them as parameters in the query?


Thank you in advance.




how can i fill in text boxes on a form with data from a table?




Hello again!
Number of current record in Text Box or Label (SAME NUMBER AS ON NAVIGATION PANEL)?
Greetings from Sarajevo,
Haris




Hi all,

I have a problem clearing or displaying empty values in text boxes.
These fields are binding to a table and are storing integer data type. I want to clear the values in these text boxes when user clicks on a button but the fields that stores the number gives me this error message:
Run time error 2757
There was a problem accessing a property or method of the OLE object.

here is my code:
Private Sub msp_barcode_Click()
Me!msp_barcode.Value = ""
Me!material_lotnum.Value = ""
Me!insert_lotnum.Value = ""
Me!mfg_dt.Value = ""

doesn't work
Me!bag_num.Value = ""
Me!bag_quantity.Value = ""

works
Me!bag_num.Value = 0
Me!bag_quantity.Value = 0

It makes sense not be able to store empty string in integer field but I can't figure how?

I appreciate your input.




I have a query that retrieves an employees schedule for the week. There is a field for start time and a field for finish time. I then place those values in text boxes on a schedule form. Sunday through Saturday.

Long story short, I would like to subtract the finish time from the start time and then format it.
Example;
Start = 8:15AM
Finish = 5:32PM
Total Hours Worked (formatted to look like this): 9h 17m

I have this working right now. The problem is, when the text boxes are empty, it throws an exception. I have it working fine until it reaches a day with no entry. For instance, If Sunday and Monday both have start and finish time entrys in their respective text boxes, the label below it holding the hours worked is good. But then Tuesday the employee is off, and it throws an invalid type error. Wednesday, etc., there are entries, but it doesn't go any further.

Any ideas?




i have sub form built on query that running according to two combo box in the main form >
i designed the sub form to show only one field form the query , my problem is i do not like the frame of the sub form and wish if i could show the result in text box instead ,
so are there any way to achieve that ?
regards
sherif




Hi,

I am using Query Design with MS Access 2007 to create a query for selecting/extracting a data set.

I make 2 text boxes named "Week From" & "Week To" on a form so that when I enter 2 numbers (but with Text type) in the text boxes and click a button running the query, I would get a selected data set for the specific period.

For example, when I enter "1" in "Week From" and 8 in "Week To", I should get the data set about the period from Week 1 to Week 8.

The problem is:
The data type of the corresponding fields in the table for "Week From" & "Week To" is Integer. So, I need to convert the 2 text boxes from Text to Integer or Number.

I try to use the function Cint (please see below) in the query, but get error message.
* =CInt([Forms]![Extract Data]![Week From])

Why? How to convert the Text values in Text Boxes and use them as parameters in the query?


Thank you in advance.




I am selecting a row from a list box. When I click on a row, it is highlighted and the bound text box fields on the main form are updated to the contents of the selected record. When I click on a new row in the list box, I want only the new row to be highlighted. My problem is that the highlight stays on the old row(sometimes) and I end up with multiple highlighhtd rows. How do I clear highlights from the list box??

Also, I would like to replace a value in a field (MCAT) from the table whenever a list box row is selected (single click) to show that the record was selected. How do I update the selected record ??


I tried .edit
!mcat="XXX"
.update

but that didn't work .

The query for the list box is below..

SELECT [vw01mast].[MDSC], [vw01mast].[MUPC] FROM vw01mast ORDER BY [vw01mast].[MDSC], [vw01mast].[MUPC];


Thanks,
David Brown




I searched Google and this forum, and maybe I did not know the correct phrase to search against, but I did not find anything on this issue.

I have an MS Access 2003 database with a SQL back-end. It works great, quick, multiple users in at the same time with no issues, etc.

But a user has showed me a strange problem I cannot really trap, much less find a cause or a solution. There are some large text boxes on the form, that allow for multiple lines of entry. They will display up to 5 lines of text, and about 100 characters wide (so they are very large).

Randomly (I cannot get it to repeat) the text will delete incorrectly. When you first go to a tab (the form has 7 tabs on it) the text in the large text boxes is highlighted. So the users scroll to the end of the text (which un-highlights the text) then they press the space bar (to start typing again) and randomly all the text will delete and be replaced with the space bar. It is as if the text was never unselected, even though the high lighting is gone, and the text has been unselected by clicking within the text and scrolling to the end of the text.

Has anyone run into this before, and if so, is there anything that can be done to fix the error? I am going to add the Zoom box functionality, with the code...

SendKeys "+{F2}", True

Thank you!

T.J.




I am at the first steps with Access and I am having trouble.
I have a table for fuel Consumption which I have created a form. I need the form to show the details of pieces of equipment in text boxes when I select its name from a Combo Box. The details for the equipment is in another table called Equipment list.
Can someone help please?




Based on earlier suggestions against Split Forms, I've converted to using a Subform. I still can't get data from the subform into the main form.

The simplified main form has 3 text boxes and a Requery button (with macro).
Two text boxes are used as criteria in a Query.
The criteria for the first text box is Like simMainForm.criteriaOne OR simMainForm.criteriaOne is null. The other one is similar.
This allows wild cards in the criteria text boxes if desired. (E.G. searching for Roger or Rodger is accomplished with Ro*ger).
The third text box is to receive a field from a row in the dynaset created in the Sub Form window.

The query has a Form built over it (simplest automatically generated form) that was dragged on to the Main form.

In Form view, the access part of the operation performs as expected - Fill in one or both of the criteria and click the requery button. The sub form works fine. I can select a row other than the first and it gets highlighted.

I having two sorts of trouble with the Third text box that should get one of the columns values from the selected row.

First, I can't get it to contain anything that resembles the column from the sub form dynaset. It's not blank but it just picked some random value from the correct column (it is a date) but it doesn't match the date of any of the records.

Second, assuming we get the syntax for that reference squared away, how do I get the value from the currently selected row?

This is probably a syntax thing - but maybe not. The text box seems to only accept one dot level in the datasource property. Longer things get chopped off.

I'd like to do this with just levels of dots of qualifications to get the right result returned. This should not have to be procedural. If code is required, I'd like to use the macro facilities of Access 2010 and not get into VBA. The naming conventions for collections of collections of collections ... makes it really easy to leave out an important level.

Thanks in advance for your help.




Hi Everyone,

I am having an issue putting an expression in a text box on my form. I listed the two controls I am using and the expression below them. I am setting the Control Source as the expression. I did some trouble shooting by putting the text box just equal to the first control and then to just the second one. They show the correct values individually but when I put them in the expression they don't work. I did find out that the part where it goes wrong is at the addition. How I found that is I took out adding of the second control all together and it came out with the correct date. All I am trying to do is add a number to the amount of years and display it. Thank you for your help.


Control #1 (Text Box): [recordfye] = date
Control #2 (Combo Box): [catcbo]![column](6) = number

DateSerial(Year([recordfye])+[catcbo]![column](6),Month([recordfye]),Day([recordfye]))




I am having trouble with something I think should be simple but its kicking my butt. I am trying to take the number of records in a query (don't matter what is in the boxes) and display that number in a text box in a main form. I am using multiple queries and 1 form.




I have been trying to figure out a way to essentially force a subreport into a text box on the main report. For example, I have a main table and then two related tables that have only two fields: the ID code relating the subordinate tables to the main, and one other field.

Because there are often multiple records in the subordinate table for each record in the main table, and because the data contained in the subordinate records is very short, what I'd like to do is be able to run the data from the subordinate table horizontally, separated by commas, for each record in the master table.

The report would look something like this:

MAIN RECORD DATA
Subordinate refs: 1, 2, 3, 4, 5

In this example, "1," through "5" represents the data in each of the 5 records in the subordinate table linked to the main table.

Unless I'm missing something, a subreport would force the data to print vertically, whereas I want it to go horizontally.

Is there a way to do this? Suggestions? Thanks!




Access 97:

I have a Totals query that results in one number (using the Count function). I have a text box control on a report. I have set the Control Source property to =[Totals query name]![query field name] but get #Name as an error (the names of the text box control, report and query are all very different and do not conflict).

Am I going about this in the wrong way?

Thanks,

Richard




Hello,

Is there anyway of forcing a carriage return in a textbox within a report?

So instead of having say 6 seperate fields within the report to detail an address. ie [CompName],[Add1],[Add2],[Town],[County],[PostCode] - you could have one text-box within the report whose control source would look something like:

=[CompName] & vbCrLf & [Add1] & vbCrLf & [Add2]..........

Thankyou

Dan