I would like to disable editing in a text box once the information has been entered initially, but would like to be able to turn editing back on by double clicking the text box label. This is to be used for a database I'm creating for truck fleet management. Any ideas??
I have a form that displays fields from two tables. I have set the properties of Allow Edit, Allow Additions, Allow Update, Data Entry to NO. However I want to allow users to be able to add new, edit/update and delete records from the form by clicking on respective command buttons.
the problem is that the code that I am using is giving me errors that says that I "You cannot go to the specified field" I need help on proper VB code to use that will allow me to enable input and update on the records in the table.
how can i disable a textfield or two in a form when the textbox is unchecked also how do i add a default value for it while the textbox itself is disabled, can i get away with it by adding a default value on the textbox?
using Ms access 2010.I have two text boxes where depending on what is entered on the first the 2nd disabled.that works fine but if I make a mistake and enters a value on the 2nd while it is enabled and return back to the first and enters a value which disable the 2nd, it disable it ok but keeps the value and even save it to the table.
Private Sub q300_AfterUpdate() If Me.q300 = "1" Then Me.q300_1.Text = "" Me.q300_1.Enabled = False Me.q301.SetFocus Else Me.q300_1.Enabled = True End If End Sub
I'm currently using the following to edit a publisher document using access VBA.
Code: For Each pubShape In pubDoc.Pages(1).Shapes If pubShape.HasTextFrame Then If pubShape.Name = "Text Box 440" Then pubShape.TextFrame.TextRange.Text = Item1 If pubShape.Name = "Text Box 441" Then pubShape.TextFrame.TextRange.Text = Item2 If pubShape.Name = "Text Box 442" Then pubShape.TextFrame.TextRange.Text = Item3 If pubShape.Name = "Text Box 443" Then pubShape.TextFrame.TextRange.Text = Item4 If pubShape.Name = "Text Box 444" Then pubShape.TextFrame.TextRange.Text = Item5 If pubShape.Name = "Text Box 445" Then pubShape.TextFrame.TextRange.Text = Item6 If pubShape.Name = "Text Box 446" Then pubShape.TextFrame.TextRange.Text = Item7 If pubShape.Name = "Text Box 447" Then pubShape.TextFrame.TextRange.Text = Item8 End If Next
Obviously there are a lot of shapes/boxes etc in the document and this code is very inefficient and takes a few moments to complete. Is there a way to directly reference a text box and change its value. For word I have been using bookmarks but this doesn't seem to work with publisher.
I'm looking for something like pubshape.Value("text Box 440") = Item1 but cannot find the correct syntax.
I have a form that utilizes a combo box called cboProgAddr (for Program Address). The cbox has 5 columns each of which fills in an adjacent text box. Since I needed the option of making corrections to these text boxes once they were filled in I need to set them up as unbound via the following code in the After Update event of cboProgAddr:
Private Sub cboProgAddr_AfterUpdate() Me!txtProgStreet.Value = Me!cboProgAddr.Column(1) Me!txtLocStreet.Value = Me!cboProgAddr.Column(1) Me!txtProgCitySt.Value = Me!cboProgAddr.Column(2) Me!txtLocCitySt.Value = Me!cboProgAddr.Column(2) Me!txtProgZip.Value = Me!cboProgAddr.Column(3) Me!txtLocZip.Value = Me!cboProgAddr.Column(3) End Sub
As you can see it puts each field of data into two separate text boxes. Here's the issue: If I have to go back to the form after the original data entry the following boxes are blank...
txtProgStreet txtProgCitySt txtProgZip
while the following retain the orginal data...
txtLocStreet txtLocCitySt txtLocProgZip
The original cboProgAddr maintains its original data. All six fields above are stored in the same table as text field. I'd like all the boxes to maintain the data from the original input.
I'm totally baffled why this is so. I've attached images of the combo box control functions if that helps.
On a form, I want to disable the save button, 'cmdSave' whilst the form's mandatory fields have been left blank.
I've put in a smart tag, called, 'Req' against each required field and have used the following code on the forms current event.
Code: Private Sub Form_Current() Dim ctl As Control For Each ctl In Me.Controls If ctl.ControlType = acTextBox Or ctl.ControlType = acComboBox Or ctl.ControlType = acListBox Then
[Code] ....
The save button is disabled, but it won't enable again after each field has data entered against it.
I also have this code in the AfterUpdate event in each required field:
Code: Private Sub cboErrorID_AfterUpdate() Call Form_Current End Sub
I know how to disable the min / max buttons on a form, but can anybody provide help with disabling the Min / Max buttons of the access application itself, I recently found some code that somebody had posted to disable the "X" button, now I would like to disable the min / max function as well.
I am just about to set up user level security for my database. Before I do, how do I disable the holding the shift key thing when opening a database to get into the database window?
I want to make it so the users can't see the database window or access the backend data. As I will need to give permissions to use most of the tables, how is this done?
I need to disable the [Shift] key so that when the users open my MS Access database, they cannot by pass the open form and display the database window.
We had code that worked correctly with an MS Access 2000 MDB, and even works with an MS Access 2003 ADP, but the same code is ignored by MS Access 2003 MDB.
We add Module named "DisableByPassKey", here is the code...
Public Function SetProperties(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer On Error GoTo Err_SetProperties
Dim prps As AccessObjectProperties Dim prp As AccessObjectProperty Dim isPresent As Boolean
Set prps = Application.CurrentProject.Properties For Each prp In prps If (StrComp(prp.Name, strPropName, vbTextCompare) = 0) Then isPresent = True Exit For End If Next
If (isPresent) Then prps(strPropName).Value = varPropValue Else prps.Add strPropName, varPropValue End If
Exit_SetProperties: Exit Function
Err_SetProperties: If Err = 3270 Then 'Property not found Properties.Append prp Resume Next Else SetProperties = False MsgBox "Runtime Error # " & Err.Number & vbCrLf & vbLf & Err.Description Resume Exit_SetProperties End If
End Function
The code does not cause an error, it just seems to do nothing. When I set the [Shift] key to "disabled", then re-open the database, the [Shift] key works once again.
Hi, I have a text box in a from for data entry, how do I disable a space. For example I don't want the user to have a space between charaters or before and after a charater. Thanks.
The code to disable shift keys at start up that has been posted here numeroous times is causing me problems. I am a complete novice with vba. but i cannot seem to get it to work and there seems to be a problem with the following line of code:-
db.Properties(strPropName) = varPropValue
Can anyone explain what may be going wrong. The shift key still by-passes and no password is asked for. If I do click the button on the start-up screen and enter the password I get error 3270 and the line above is highlighted.
Here is my problem: When a certain yes/no box is true (checked) other fields on the form are not enabled. That works just find when I am on the record that I click the yes/no field. When I go to another record and then go back to the previous record the fields that should be disabled due to a certain yes/no box being true are now enabled and not disabled. Below is my code. Can anyone tell me what I am doing wrong?
Hi, Im currently creating a database for an A-Level project. I am required to create a database for a real company. They have asked me to stop the right click function on forms. I have disabled almost every feature on the forms, however i cannot find a way to disable right click. Please help.
If (Me.cboStatus.Value = "Approved" Or Me.cboStatus.Value = "Approved as Noted" Or IsNull(Me.cboStatus) Or Me.RecordsetClone.RecordCount > Me.CurrentRecord) Then Me.cmdNew.Enabled = False Else Me.cmdNew.Enabled = True End If
End Sub
The navigation buttons work flawlessly but the cmdNew button still is enabled when it shouldn't be. THe idea is that is will be disabled if:
-current record is not the last record -cbostatus is blank(null) -cbostatus is "approved" -cbostatus is "approved as noted"
The only code that seems to work is the "me.recordsetclone.recordcount > Me.currentrecord" .
Am I going about this the wrong way? How can I check what is in the cbostatus box and have the cmdnew button enabled/disabled based on its value.
I have the following code in the on_load of all of my forms to disable all menus:Dim i As IntegerFor i = 1 To CommandBars.CountCommandBars(i).Enabled = FalseNext iThe problem is that when I open a report in preview mode I cannot close, print, etc.Two questions:1. Is the above approach the best way to disable all menus and toolbars?2. How do I add a custom toolbar (already created) to the report preview only. I've tried doing in in the properties and by me.toolbar = "custom toolbar." Neither approach works. I suspect that the code I've used to disable the menus is keeping me from adding custom menus where I want them?I should also mention that I have also turned off all of the menus, toolbars, etc. in the options/startup.Thanks for your help!
I have a combo box "cboSelectEvent" and a check box "ckPartRepl"
what i want is that if "cboSelectEvent" is like "X120*" then "ckPartRepl" would be disabled.
how should i write this and on which event action should i add this?
i think it should be on the lost focus or afterupdate but not sure.
should this work? i have tried it but the box always appears to be usable Code:if me.cboSelectEvent = "X120*" thenme.ckPartRepl.enabled = falseelseme.ckPartRepl.enabled = trueend if
I have one form where I want the 'Enter key to be disabled. What is the best way to disable the 'Enter key for this one form without disable'n it for the entire database?
I'm accessing an iSeries database with MS Access and Client Access ODBC driver. This works fine for reports and such, but not for editing or updating.
Trying to use edit queries, I get error 3073 (..must use an updatable query). But if I just open a table in Access and don't use a query, you should be able to edit directly into the table. But for me, this isn't possible.:confused:
Hi all, I have a search form that pulls data from a query. The data is displayed in a subform. I would like the user to be able to edit the data from the subform. I have set all the allow properties to yes and it still doesn't work. Does this problem have anything to do with relationships.
Thanks to all, this forum has been a great help for me.
I have a form called contractors. It works exactly like I want it but it won't let me edit it. The form is based on a query. I have checked the query as stated to do on some areas of this forum and I am able to change it by typing something in a field and it also updates the form for me but I can't edit the form directly. I have allow edits, allow deletions, allow additions set to yes and I have no locks on it. Any ideas?
I have also checked help in access on this to no avail. I am attaching the database so somebody can hopefully help me.
A few years ago a consultant created a database for my company and trained one person on how to use it. Unfortunately, this person shortly left and the system was never used! I would like to get the system up and running, however I am a complete novice with Access and although I have figured out the basics I am having trouble with the one form that we use to enter data. Two of the drop-down or combo boxes must be completed by the person entering data in order for the record to be saved. How do we turn off this mandatory setting for each combo box? Or how do we add an option to the combo box that at least says N/A if the data enterer does not have the information on hand?