Forms :: Setting Maximum Value In Text Box
Nov 20, 2013I have n text box on main form which contain sum of different fields.. I want to set maximum value as 1000 or sum of different fields.
View RepliesI have n text box on main form which contain sum of different fields.. I want to set maximum value as 1000 or sum of different fields.
View RepliesI have an unbound form which has 2 unbound combo boxes on it, both based on the same table, but I have used a query for each one to created the sort order, one alphabetically by item name (cmbA) and the other numerically by the item number (cmbN) . I also have a text field (ID) upon which is based a report when the user clicks a button. Currently the text box (ID) has a control source of column 1 of cmbA and I have the report working perfectly if one selects from the name combo box (cmbA) What I want to do is allow the user to select from cmbN and have the control source of the ID text box equal the number the selected so the report button will work then also.
I have tried to set the control source after update of cmbN but all that does is blank out the ID text box. I have not done this before so I am sure I have done it incorrectly. I tried again this morning using me.ID.ControlSource = Me.cmbN and stepping through the code shows that the cmbN ControlSource is equal to ID but I can't make the code that follows use the results.
I have a form that adds a record to a table in the database.I want that when i choose a value from a combobox in the form, it will change the value of another textbox according to what value was choosed.So essentially what i did is simply go to the combobox AfterUpdate and there i used this code:
If Me.Combobox.Text = "Solid" Then
Me.TextBox1.Text = "grams"
ElseIf Me.Combobox.Text = "Liquid" Then
Me.TextBox1.Text = "ml"
End If
But i encounter 2 problems:
1. When i set a default value to the textbox (which i want to), the changing of the value in the combobox doesn't do anything whatsoever.
2. When i remove any default value from the textbox, the changing of the value in the combobox does change the textbox to the corresponding value but then gives run-time error 2185: "You can't reference a property or method for a control unless the control has the focus".
Is there a way to setup the format on fields to only allow text inputs, no numbers wanted. I know I can do this at the table level but is some cases numbers are ok. So I want to code it so I can control when numbers are ok and when there not.
View 1 Replies View RelatedI want to be able to set text boxes so that if one enters a date and a time it displays in the format "dd/mm/yyyy hh:mm", but if one just enters a date is displays in the format "dd/mm/yyyy". Is this possible?
Stipulating "dd/mm/yyyy hh:mm" means that when you just enter a date it adds "0" values for the time e.g. entering "21/6/13" gives "21/06/2013 00:00".
General Date allows for an optional time, but it means that when you do enter a time it gives you seconds as well "dd/mm/yyyy hh:mm:ss" - and I don't want that.
Is there a way to increase the maximum characters allowed in an expression of a macro setvalue action ?
I have an expression in a macro setvalue action that adds multiple form textbox values. I need to change the form name from "RATING ENGINE 2" to "E RATING ENGINE 2". When I do this, I exceed the maximum characters allowed in the expression. Is there a way I can rename "RATING ENGINE 2" without this problem. The expression is as follows:
[Forms]![RATING ENGINE 2]![Excess Liab Premium 6]+[Forms]![RATING ENGINE 2]![Excess Liab Premium 7]+[Forms]![RATING ENGINE 2]![Excess Liab Premium 8]+[Forms]![RATING ENGINE 2]![Excess Liab Premium 9]+[Forms]![RATING ENGINE 2]![Excess Liab Premium 10]
Hi All,
I have only been playing with MS Access for a little while and I do not know all there is to know yet so I figured I come here to ask a question.
I use MS Access in web design and lately I have been experiencing a problem with my registration form which inserts new users into an MS Access database table.
Lately my registration form has become a target for spammers trying to inject spam in the form of html code into the password field of the online registration form.
I figured that I could deter this from happening by only allowing the letters A - Z and numbers 0 - 9 in the field and not allowing characters like < > and ? and ".
I assume I can do this with a validation rule but I'm unsure as to how I would go about setting this up. Limiting the field size to only 50 characters does not seem to work unfortunately.
Any help on how to set up a validation rule would be appreciated.
Thanks
Mechaworx
This is the first time that I have done any major work with forms. After I thought I had finished a problem came up. There are several forms that are use to input information into a table. When the form is opened it grabs an automated number for tracking. The problem is, that if the form is opened and then closed it creates a line of data with all null values.
What I would like to do is have the form open, the user fills out the information, and upon pressing the "save" button, the data will save to the table. I think I need to have each text box write to a variable and then save on the click event. Or I could be completely wrong and need to do something else.
i'm guessing this is something I would learn in Forms 101 if i had ever taken that type of course
Thanks
I am creating a database that should be fairly simple. The database is for a local racetrack and I'm stuck on how to entering race results. I have four tables: Driver, Rank, Home, Class. The form to enter in the results contains a main form with a subform. On the main form there are two combo boxes, one to select the Class of the race, and one to select the Heat of the race: i.e Finals, 1, 2, 3. The subform currently has a text box containing the rank of the driver for that race and the driver's name. I want the Rank to automatically start at one and increase by one each time a new driver is added. The rank field is part of the primary key but cannot be an autonumber field because there will be multiple ranks in the rank table. The rank table contains a primary key of: Class_ID, Rank, Heat. Therefore, each class/heat combo needs to start at 1 and increase. I created a query that finds the max rank value of the class/heat combo and I thought I could use that value +1 for the default value of the Rank field but I'm not having any luck. I have attached the database so that you can see what I all have as there isn't any sensitive information. If it would be easier doing it some other way than using the query that is fine to. I'm open to anything that works. I also want the Driver combo box in the Rank form to be limited to only contain drivers whose Class_ID matches that of the selected class in the main form. I have the row source set up sot that it works when I make my first selection when entering the form but not when I change the selected class and I do have an After_Update event set for requerying. It seems this should be so simple but I'm just missing something. Thanks in advance for your help!
View 1 Replies View RelatedHi there,
I know there have been a good number of questions about visibility in forms already but I couldn't find a solution to my problem (or maybe I just didn't get it).
Basically, I have a tabular form (more than one record displayed at once) and one the field is of the Yes/No type. For each record, I'd like to have a text box that displays 'pending', set as visible if the field value is 'Yes' and set as invisible if the field value is 'No'.
The table is as follows:
id : auto-number
Flag: Yes/No [Yes]
If I use the following code on the Flag button:
Private Sub Flag_AfterUpdate()
Me.pending2.Visible = Me.Flag.Value
End Sub
all the 'pending' text boxes appear and disappear together (instead of just the relevant one).
I thought of using another text box, with the same data source ('Flag') but which would set itself to visible or invisible wrt to its own value but I couldn't find a way to do it.
Any suggestions ?
Thanks in advance !
and many thanks already for the forum and the contributions - it's been extremely helpful, esp. for a beginner.
I am placing a breakpoint within a function that runs after an update. The function runs, but the break does not happen. Is there some setting that can be adjusted that allows this to happen?
View 2 Replies View RelatedI'm doing a little database for work and I'm having alot of problems figuring things out. This is my first attempt at anything access. I've been getting help with this so far.
What the database is for is keeping track of clients that come in and go on trial for hearing aids. Clients can have one hearing aid or one for each ear. Also for the trial they can have multiple hearing aids from different manufacturers. What we want to do is keep track of who has what and who there audiologist is, if they accept them at the end of the month then invoice cost etc. If they don't accept them then we return them back to the manufacturer as a return for credit, and would like to record there reason for not going with them.
I have my table normalized and now i'm starting to make the forms but i'm getting really confused on the process.
Right now in my thinking I think i need a form for client info, Invoice, Trial Info, Aids on Trial, and return for credit. Some of these I need fields from different tables but do not know how to do that. Maybe I should change my forms needed, I don't know.
Here is what I have so far. I just have the main page and the client info form. In the client info form I am using the notinlist event for the city field, but was wondering if there is a better way to have that set up, doing it this way is the user giong to have to enter a number into that field? How would they just enter in what city and province the client is from??
Basically my question is how to I set up forms for this database?
I have a form with a number of text, date and combo boxes. We quite often add items that are very similar, so it would be useful if the values you've just entered were kept the same for the next item. Then you can just change the odd field that's different. Is there a way to achieve this?
View 10 Replies View RelatedI have form containing 8 comboboxes. On click on command button i want to set the item/caption/selection of combobox. How should I do that? Button has OnClick event built in VBA. What would be the code?
View 3 Replies View RelatedI have two tables relating to People
PeopleType: ID and description (e.g. 1 student, 2 teacher, etc)
PeopleDetails: PeopleType.id, name, gender etc
I have a form that contains subforms
On the Main section of the form the data comes from the PeopleDetails. I want the user to fill in this but I want the PeopleType.id to be set to e.g. 2 so that you can only key in teacher details.
I have been trying to set it using a macro SetValue but i cannot get it to work.
I have a form for new customers. One of the fields is the product they have chosen ("new model", "old model", etc.) in a drop down Combo box. I want default pricing to appear in the form based on the what user selects for the product. But, I am getting nothing shown in the price box after choosing the product.
I've tried two approaches but with no luck. What am I doing wrong? This is in the default property for "price"
=DLookUp("[priceDefault]","tbl_products","[product]= '" & [productChosen] & "'")
=DLookUp("[priceDefault]","tbl_products","[product]= " & [Forms]![frm_CustomerRegistration]![productChosen])
I'm using Access 2007 and Windows 7.
I have a textbox called Odours, there are four buttons below the textbox btn_Cadaver, btn_Drugs, btn_Explosives and btn_Money.
On licking one of the buttons a value will be put in he textbox i.e. pressing the btn_Cadaver will put the value "Cadaver ()" in the textbox.
The reason I want this is that all of the entries must begin with either Cadaver, Drugs, Explosives or Money. The brackets are there to allow the user to put some free text between the brackets.
I have some code to set the cursor (on click) between the brackets
Code:
Me.Breed.SelStart = 9
I want to prevent the user from typing anywhere in the textbox except between the brackets.
I am trying to get the properties of enabled and locked set in a continuious subform depending on a yes/no field in each record. I have tried using the answer in thread 160062, but this only works when it is not a subform (unless I have done something stupid!)If the main form is frmMain and the continuious subform is frmSub, where am I going wrong with this code which is in the subforms Class Objects?
Private Sub Form_Current() If Me.MaterialIssue = True Then CRMSignOffDate.Enabled = True
CRMSignOffBy.Enabled = True CRMSignOffDate.Locked = False
CRMSignOffBy.Locked = False Else CRMSignOffDate.Enabled = False
CRMSignOffBy.Enabled = False CRMSignOffDate.Locked = True
CRMSignOffBy.Locked = True End IfEnd Submany.
How do I go about getting data from a:
Text field in Form 1
Clicking a button to run VBA code, and Automatically inserting it into a refreshed combo box in Form 2
I've also attached a pic.
*Also, I'm using Access 2007...
I want a combo box to be enabled only when I want to edit the data in the cbo for that particular record or when the fo0rm is on a new record. So, by default the cbo is Enabled No and Locked Yes. I placed a button on the form and put the following in the On Click:
Code:
Private Sub cmdEditContactsType_Click()
Me!cboContactFilter.Enabled = True
Me!cboContactFilter.Locked = False
End Sub
But when I press the button the control remains disabled.The field has several Contact genres and since I'm using the data in a split form allowing edits to the single form side I don't want this cbo enabled during browsing.
I have a form frmDisplayVars with a subform subfrmDisplayVars. The sub form initially has its RecordSource set to "" and is set dynamically from a maketable when needed.In the OnLoad for the main form, the subform RecordSource is set to a table "Table.Test". This is so that the load routine can execute a maketable query to create the form "Test" in advance. This produces a table from a crosstab query. All this works OK so far.
However, I wish to be able to double click on the datasheet in the subform to then open another form with data related to the cell/contol that was clicked on. Essentially creating a room occupancy table for a range of dates and rooms. Rows are rooms and columns are dates.
I have a problem with setting the OnBblClick for the subform controls.For example the 2 test code lines for the control "RoomName" illustrate.
Code:
Forms!frmDisplayVars!subfrmDisplayVars.Form!RoomName.Name
Forms!frmDisplayVars!subfrmDisplayVars.Form!RoomName.OnDblClick = "=TestMe()"
The first line works fine and returns as it should the name of the control "RoomName".It is the second line which I need to set the event code for OnDblClick which fails with error no. 2455 which suggests wrong syntax for referencing a control on a subform.I can't set the event procedures manually as they are not known in advance until the table "Test" is made so need to be able to set the control events dynamically.
I am having trouble setting the focus on my forms... I have a parent form with two labels that are coded like this.
Private Sub Advisory Messages_Click()
Me![ Advisory Messages].Visible = _
Not Me![Advisory Messages].Visible
End Sub
[code]...
I have the visible property set to no on the subform allowing the user to toggle the visibility when the label is clicked. The problem though is when I click inside the subform to use the scroll bar to view records, it transfers the focus to the subform making it almost impossible to close by clicking the label again because the label is on the parent form. I found the "me.parent.setfocus" command and a few other set focus commands but I don't know what I should be applying the command to in order to make it work.
I am placing a breakpoint within a function that runs after an update. The function runs, but the break does not happen. Is there some setting that can be adjusted that allows this to happen?
View 6 Replies View RelatedI have a form which contains a sub form. I have set the tab order on both forms and set the Tab stop to those I don't want. when I open the Form the cursor flashes in the sub form and I cannot find where or how to have the cursor flashing on the main form. It needs to be there because I want to select data that will edited in the Sub form.
View 3 Replies View RelatedI have a form with a tab control on it. The input for respective fields are placed inside the tab control, and I have the "Confirm" button placed outside, on the main form. Now I wanted to be able to navigate my focus from a control from inside to tab control, out to the Confirm button on the form, to allow smooth flowing data entry.
However, it seems like Access separates the tab indexes for the controls in the tab control and outside on the main form, so setting tab index does not work. I tried using the code ON LOST FOCUS and SET FOCUS;
Private Sub txtPurchaseNote_LostFocus()
Forms![frm Imported]![cmdConfirmPurchase].SetFocus
End Sub
But then a dialog box appears:
Run-time error '2110'
Microsoft access can't move focus to the control cmdConfirmPurchase
(cmdConfirmPurchase is a button control)
I have a drop-down list that when a person's first name is selected then it will fill in the person's middle and last name. Is it possible to use a name that is frequently used as the default so that it is always filled in on the form? More specifically, how will it work so that the other fields (middle name and last name) will also be filled in with the default first name? Or is this not possible to do?
View 4 Replies View Related