Modules & VBA :: Unhooking Fields / Controls / From Each Other In Forms
Jul 14, 2013
I have a form. I want to move a field and it's label. I need to unhook it from the other fields or I can't.
I found this post on another forum: [URL]
It says, in part, When you create your form, before you do anything else, open it in design view. Right click on the top-most of the stacked controls and choose Layout | Remove on the shortcut menu. All the controls are free to move individually now.
alas, I don't know where the "stacked controls" are or Layout/Remove or any "shortcut menus of any kind". (oh how I long for the simpler days of "ordinary" menus (easily accessible from the keyboard.)
I have a form and a subform in MS Access 2003. I have made some changes to database structure, so I decided to change the subform also. When I changed the Link child and link master fields, the controls of the subdatasheet dissapear- they show only in design view. If I clear the contents of Link child and link master fields they appear again, but the records are not binded. Is there a setting on the parent form that also has to be changed, to make the new binding?
I'm in the middle of writing a multi-language procedure, and in order to populate the label database I would like to cycle all forms (regardless of whether they're open or closed) and cycle all controls within the forms.
I have a bit of code that uses controls on a form to batch add records to the tables. Before the code executes, it needs to do a check to make sure that all of the needed data has been supplied.
Code:
If IsNull(txtDateAdded) Then MsgBox "Please supply the date that the Label record was created" Exit Sub Else If IsNull(cboRecordCreator) Then
Using Activex controls for capturing video from a webcam or similar. Just looking for a snapshot that I could then forward via email from access.
Ive seen commercial licenses for an activex control. The form Im imagining would have a window showing the live video with a snapshot button where we could store the image as a jpg for example and then generate an email forwarding on the image. It seems possible!
I'm using a mousemove event to display help text for controls in my form.This works well, but I'd like to display help text when the control is disabled as well (to explain to the user why it's disabled).is there any way to fire a mousemove event when hovering over a disabled control?
i have created a module under module section of my DB My Report Name : "PURCH VB Query"
the code is as follows : (what is want tell you later..)
Code:
Sub Erlick() DoCmd.SelectObject acReport, "PURCH VB Query", True '"PURCH VB Query", acViewPreview, "PURCH VB Query" For i = 1 To 3 DoCmd.PrintOut acPrintAll, , , , i Next i
'This is for creating Seperate Text Per Copy in RptHeader Preview End Sub
i've placed a TextBox in my report named Text25 to the value : =+1 properties-->data-->running sum--> Set to OVer all
i've also set a textbox in my report named CpyWord to the value : =IIf([Text25]=1,"Original Buyer Copy", IIf([Text25]=2,"Duplicate File copy",))
Now what is want is Three Copies of Report with Two copies marked seperately as per above IIF statement
As i want Three Copies with each Rpt-header as Different Text
Possible solutions (ba donna no a script) How do i refer to Report's control after Docmd.SelectObj.... if any facility then i can do easily thru the dazzling for next loop How do i increase Report's control Text25's value, if three copies r there I know there are many events in Report
I've stucked over this point. My all App in db is ready
Basically I have a class event that works for all controls on any userform.
Its all working fine but I can't add an event to trap the click or mouse move of the userform itself.
Basically so when the cursor moves away from a control the label clears.
User Form Code
Code: Option Compare Database Option Explicit 'Define a collection and initialise the commandbutton event class Private col As New Collection Private newCmd As New clsEvents
[Code] .....
And here is the class Module
Code: Option Compare Database Option Explicit 'catch the event of Commandbuttons Private WithEvents C0 As SubForm 'Private WithEvents C1 As CheckBox
I'm working on a code that checks all blank/null text fields and combo boxes in a form and notifies the user if a field is not filled. The code below works if all fields are required, but I can't use it on forms that have fields that are not really mandatory. I've read somewhere on the net to use tags on the controls i want to skip checking, but that's where i get lost.
Code: Dim stdResponse As Variant Dim ctl As Control ' Enumerate Controls collection. For Each ctl In Me.Controls ' Check to see if control is text box
I have this code that works. I have a form with 3 tabs. When I select the middle tab I am prompted for password but if I click the 3rd tab I am not.
Code: Private Sub TabCtl9_Change() Dim strInput As String Dim ctl As Control ' Hide controls on tab until correct password is entered For Each ctl In Controls
I have a problem with formating controls in a form. As a example, I inserted a tree view control and adobe reader control. After I've resized them manually in a design form, I switch into form view and they both resize automatically to their own size (don't know where it gets from).
In the result, I can't obtain the required width and height. How can I make them resizable to my own preference?
I have a sub form that allows users to add staff to a project team, once added it populates a table which updates the subform showing the selected employee. I am trying to enable a delete function that allows users to remove an employee from the project team in the subform showing selected staff. Here is the code I have so far, but it doesn't work;
Code: Private Sub Command4_Click() Dim dbs As Database Dim rs As Recordset Dim sqlstr As String Set dbs = CurrentDb sqlstr = "DELETE tbl_CapexStaff.* FROM tbl_CapexStaff WHERE CAP_ID = Forms!frm_Switchboard.CAP_Live" dbs.Execute (sqlstr) End Sub
I am trying to create a customizable report that would allow the users to choose fields. I have a pretty common code that I found online and adapted it, but it fails on the first SetReportControl function.
The error reads: Run-time error 2465: Application-defined or object-defined error
Could it be something as simple as an incorrect reference? I have checked multiple times, but I am stumped.
Code: Option Compare Database Option Explicit Sub MakeReport()
[Code].....
This is a trial run, in the end I need to be able to open a report, then adjust the Report controls within 1 or more subreports inside the main report. That is a battle for another day.
I have placed an unbound subform on a form. I have the following code which loads in different datasheet to the subform:
'Loads in NewQuery Me.data.SourceObject = "query.NewQuery"
'Loads in NewQuery2 Me.data.SourceObject = "query.NewQuery2"
etc.... this works fine to show these queries but i want to know how to reference the fields on the datasheet.
for example one of the fields in NewQuery is "ID"... When clicked i want to run code... normally on bound subform i could go for example ID_Click()... msgbox(me.ID)
how can i reference these other fields on unbound???
I want to use a tab form where the user can click add, search, and edit records all from 3 tabs. The problem is I only want to be able to add data on one form, edit data on another, and just read only on the search. This seems to cause a dilemma, how can I specifiy them to add, edit, and read only on one form using tabs?
I am making a database that will be used by multiple people on a network, and they have different resoloutions on their own computers. when the database is loaded on their respective computers, the form controls are all off.
On the computer i designed them on, the forms fit perfectly on screen, as do the controls, i would like to know if there is some vba code i could incorporate into the form open event, or module code that i can use in order to dynamically re-seize the forms and all of the controls to suit different resoloutions?
I have a subform which lists a set of records. In the footer section of the subform, I have a number of controls which display calculations based on the records present.
The number of records in the subform will change (reduce). Basically, this is a review / approval function, the idea being that each record will be checked and approved, which will then remove it from the list.
So eventually, all of the records in the subform should disappear (the subform is requeried each time the user approves a record)
I want to be able to hide the controls in the footer section once the subform has been cleared of all records.
But not sure
a) how to determine when the subform's recordset reaches zero and
b) what event to use to fire the code to hide the footer controls.
This is my basic attempt :
Code: Private Sub Form_Current()Dim ctl As Control For Each ctl In Me.FormFooter.Controls ctl.Visible = Not (Me.Recordset.EOF) Next ctl End Sub
But it doesn't work (it only seems to fire when the subform is loaded, not when it is requeried after each approval?)
I've tried Form_Query, Form_DataChange and Form_DataSetChange but no joy with those either.
I have a main form, 2 sub forms, and 2 text-boxes on the main form. I have a search box now for the first subform. Works perfectly. Once the users filtered based on name, I want them to be able to select that filtered record which would filter another subform.
Right? ok.
My first attempt was to assign the ID that was selected to a textbox on the main form, then automatically requery the second subform based on that value. I used this way on my search box. I'm sure there is a way to go directly from clicking the value to requerying the second subform, but i don't know it.
That being said even the indirect first attempt isn't working. It all has to do with the ".", "!", and ordering of this stuff. It has to do something with Parent child, but beyond that I'm at a loss.
I did find this very useful site [URL] ...... It shows what code you can use depending on where you are and what you're doing. Even with that as a resource, i'm still at a loss.
I have a report that tracks scores for our employees. From the report, you can click a button to add a new score in a form or edit an existing score(frmscoretracker). On this form there are two subforms, in a tabbed control to track additional information about the score; what areas were marked down(Trends), and was it a failing score(AutoFail).
When this form opens I have it programmed to only show the subform if there is data in it. The goal being, if I am adding a new score and there is no existing trends or Autofails for this new record, neither subforms will show - I will add an after update even to show either trends or autofail depending on the score recorded. Also, if someone chooses to edit the score, whatever subform with data, will show as well.
When someone clicks to add a new score, opening this main form to a new record, both of the tabs show. However, if the form opens to an existing record, the appropriate tab shows. Here is the code
Code:
Private Sub Form_Open(Cancel As Integer) 'If the subform has a record, the tab is visible, if not, the tab is not visible If Me.frmtrends.Form.Recordset.RecordCount > 0 Or IsNull(Me.Trends) Then Me.Trends.Visible = True Me.TabCtl33.Visible = True Else Me.Trends.Visible = False End If
[code]...
Both tabs are set as not visible in the default settings. Is there something in this code that is triggering then to be visible when there is no record in the main form?
I've been puzzling over this one for a few days. I've done a few searches on here to borrow some code - but the fact is I don't understand how to implement the suggestions. I'm hoping somone can help.
Basically, I have a form for editing the database, however, there are a number of reasons for opening this form - so at the moment I have several copies of the same form all with very minor changes. In order to streamline the way I've done this, I'd rather have controls always call up the same Form - but state in their code whether or not certain controls on the editing form are visible or not...
:mad: :eek: :mad: :eek: :confused:
It's all gone rather Pete Tong here. And I must admit I'm button bashing the code a bit now. Basically, when a button is pressed, I want it to load the form "frmEditJob". Depending on what I want visible, the Tags "N, M and V" will activate and deactivate certain controls on "frmEditJob".
With me? :confused:
Any help is appreciated!
Cheers.
Private Sub EditJob_Click() On Error GoTo Err_EditJob_Click
Dim stDocName As String Dim stLinkCriteria As String
If IsNull(Me![IDEntry]) Then strMsg = "You need to enter a Valid ID number in the box provided." strTitle = "ID Number Error" intStyle = vbOKOnly MsgBox strMsg, intStyle, strTitle Exit Sub End If
I'm new to Access and am having trouble designing a database that houses application details.
All applications have a list of unique wrap id's but have different tables housing different details for these wraps.
I have a main table which is for data entry and lets me input whether or not a piece of software is Vista compatible (yes/no) etc.
I also have a field in this table showing which analyst is responsible for researching compatiblity of an application.
I have another table with different regions i.e. london, manchester etc that has the region/city listed as the field heading and then contains a list of wraps used in that city under the relevant field.
My main entry form is linked to the main data entry table that holds specifics for an app, name, vista compatible etc. This form is used for data entry. I want to add a subform on this form which shows a list of all applications, in table format, but I want a drop down list so I can select an analyst name / region so that analysts can update details for a specific area assigned to them. In the table I want all of the records based on this criteria to be displayed.
I guess I need to make a filter button on my subform but do not know how to do this. I put in a button control for apply filter by form but then dont know what to do.
I'm new to access and don't know much VB - e.g. the only thing I can do in VB is a make a message box that says hello world on the screen.
Any help is sincerely appreciated. Apologies for the Essay.
I have a subroutine which cycles through all controls on a form, and for controls with applicable tags, either enables or disables the control.
The routine accepts a form as the parameter (frm), and is called from a button on the form itself.
Despite trying frm.repaint in the generic routine, and, me.repaint from the calling form, the controls do not seem to repaint until the mouse moves over them. A command button, for example, will be grey-ed out, despite being enabled, but will un-grey when the mouse goes over it.
I have a main form, lets call it FrmMain. In addition, I have a subform on FrmMain that has a tab control on it (frmSubform). What I would like to do is on form load, reference the tab control that is on the subform, loop through the controls/textboxes, lock them and change their backcolor. The code I am attempting is listed below, however, I am getting a "type mismatch error" highlighting this line:
PHP Code:
Set Frm = Forms!frmConsultingMain!FrmConsultingFeeData
Below is my code:
PHP Code:
Dim ctl As ControlDim Frm As FormSet Frm = Forms!frmmain!FrmSubformFor Each ctl In Frm.Controls If (TypeName(ctl) = "Textbox" Or (TypeName(ctl) = "combobox") Or (TypeName(ctl) = "listbox")) Then ctl.Value = Null ctl.BackColor = vbYellow ctl.Locked = True End IfNext ctl