Forms :: Writing A Sub To Change Controls

Oct 10, 2014

I have a form with 10 text boxes on it. depending on a Case

I would like to change the special effect and backcolor

select case colour()
case red
Me.Txt1.specialeffect = 1
Me.Txt1.backcolor = RGB(256,256,256,)
case green
etc

I'm trying to write something so that i can apply both these settings to any text box easily.

View Replies


ADVERTISEMENT

Queries :: Change SQL Where Based On Form Controls

Jun 30, 2015

I have a form with a combobox, textbox, a button and a listbox.

Currently the button checks if the textbox is empty and if it is, it runs a SQL query to select data using the combobox value in the where clause, else it selects data using the textbox value in the where clause

I need to be able to type or select values in both controls and use those values in the SQL query as a where.

View 6 Replies View Related

Forms :: WRITING Records Which Had Been Used By Others

Aug 9, 2015

Firstly, I create a form and sub-form relationship of which the sub-form linked with a combobox on main form. When user wondering in the combobox, the subform could display relavant records related to the invoice number selected in the combobox.

In the subform, records got a YES/NO field (named CHECKAMT) and when I used the following coding to update records in the subform, a message something liked saying the record had been used by another user, you may overwrite those records, copy those records to another place or undo and quit!!

Set TRANS2 = db.OpenRecordset("select * " & " from MSQUARE WHERE INVNO = '" & Me.INVONUM & "'", dbOpenDynaset)
TRANS2.MoveFirst
Do While Not TRANS2.EOF
TRANS2.Edit
TRANS2![AMOUNT] = Null
TRANS2![checkAMT] = -1
TRANS2.UPDATE
TRANS2.MoveFirst
LOOP

View 14 Replies View Related

Forms :: Writing To A Textbox - Cannot Assign Vale To This Object

Mar 28, 2013

Having problems writing to this textbox on my form?

Textbox name is: Last_Name
Text Control Source is :Last_Name
Line of code is :

Code:
Me.Last_Name = Me.Combo0.Column(4)

I get the following data in the textbox " #Name?"

And the error:

" You cannot assign a value to this object"

View 7 Replies View Related

General :: How To Make Form Controls Change Size / Position As Form Is Resized

Jul 24, 2013

how to make my form controls change size / position as my form is resized / loaded on a computer with a different resolution. Several of the tutorials out there suggest putting code on the "on resize" property of the form. When I looked at the Northwind database to try to mimic their code however, it looks like they must be doing something different as there is no on resize code under the form properties and I was unable to find the code they do use.

View 4 Replies View Related

Forms :: Binding Results Of Query To Textbox Then Writing Value To Table?

May 19, 2015

Basically, I originally wanted to create a form which I can input data into Access with by using a button (I was unable to get Access to append the information from the forms to the table, so it didn't work out!). I did not want the fields on the form to be linked to a table, as then a record (and most importantly an auto-number) is created as soon as somebody starts typing. Should somebody stop typing halfway through and quit the form an autonumber will have been generated, which makes the number of "users" seem higher than it actually is. I got around this by changing the field from autonumber to number and then creating a query that selects the maximum value of ID in the table, then adds 1 to it (which is essentially the lowest unique number. I tend to call this newID).

The problem I now have is setting this to be written to the table alongside the data from the form (the rest of the fields on the form are now connected to the table, as I am no longer using an autonumber). I have tried the following: Setting the form to run the expression "[ID] = [qryMaximumUserID]![NewID] " on load. This returns the error "The object doesn't contain the Automation object 'qryMaximumUserID.' Setting the control source of the text box to be dLookup. This fills the textbox with the correct value, but then it doesn't write it to the table! Setting the default value of the field to be 0, then running an update query to update any ID of 0 (criteria "0" to the value of newID "update to: [qryMaximumUserID].[NewID]. "). However this doesn't work as whenever the query is run it asks for a parameter to be entered, rather than just taking the value from the other query. Writing a macro that is run on load to SetValue of item:[ID] to expression: [Forms]![qryMaximumUserID]![NewID]. However this returns an error "Microsoft Access cannot find the referenced form 'qryMaximumUserID' you entered in the expression.

View 4 Replies View Related

Forms :: Block User From Writing In Textboxes If They Have Not Selected A Date

Aug 21, 2014

I have a form that has four textboxes, date dropdown box and a date box. I am trying to get the form to do the following: Block user from writing in the textboxes if they have not selected a date in the date box.

Get the datebox to look at the behide screens records to see if there has already been a documented date (duplicate date) and inform the user that this date has already been used. Then auto them to the date dropdown.

View 2 Replies View Related

Forms :: Writing Data Into Text Boxes On A Form Using Variable In Name

Jan 29, 2015

I'm trying to write code which writes text into text boxes on a form depending of certain content of other text boxes. The names of the text boxes are all very similar

F.i. R1, R2, R3 ...... R12 if the content of these boxes are empty then the content of the corresponding text boxes VR1, IR1, VR2, IR2, VR3, IR3.......VR12, IR12 should also be empty.

In fact I am trying to write something like this

DO UNTIL i=12
if me.R(i).value = "" then
me.VR(i).value = ""
me.IR(i).value = ""
endif
LOOP

But this isn't working. The solution below works but isn't a very nice one, writing 12 times the same code

if me.R1.value = "" then
me.VR1.value = ""
me.IR1.value = ""
endif

if me.R2.value = "" then
me.VR2.value = ""
me.IR2.value = ""
endif

View 4 Replies View Related

Forms :: Change Button Color After Data Change

Apr 5, 2014

I am trying to change the button color on a subform if a related form data changes.Main form is products with a continuous subform with serial numbers of products i.e, serial number, location, price and a button to add addtional issues if there are any for this particular serial number (this will open up another form related to the serial number so I can add an issues if there are any).The reason I would like the button to be a different color is so I can quickly see if there are any additional notes been added to the serial number. Just in case you may ask why not add the field to the continuos form is that the issues and be quite lengthy and there may be lots of serial numbers on the form

2346 location warehouse price 29.99 (button - green)
2347 location shop price 29.99 (button - red)

View 1 Replies View Related

Tab Controls - Two Forms

Jun 2, 2005

Hello,

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?

Mateo

View 1 Replies View Related

Forms :: Dynamically Resizing Forms And Controls

Oct 31, 2013

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?

View 6 Replies View Related

Referencing Controls On Forms

Mar 30, 2012

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.

Code:
Me.[Collateral] = Acct_Reference_id
Me.[Navigation]![textbox] = Acct_Reference_id
...
'Me!Subform1.Form!ControlName
'Me!Subform2.Form!ControlName
'Me.Parent!ControlName

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.

View 7 Replies View Related

Remove Controls On A Forms' Opening

Sep 29, 2006

Hi there,

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

stDocName = "frmEditJob"
Dim ctl As Control

stLinkCriteria = "[WorkorderID]=" & Me![IDEntry]
DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria


If ctl.Properties("Tag") = "N" Then
ctl.Properties("Visible") = False
Else
ctl.Properties("Visible") = True
End If

Exit_EditJob_Click:
Exit Sub

Err_EditJob_Click:
MsgBox Err.Description
Resume Exit_EditJob_Click


End Sub

View 5 Replies View Related

Forms- Subtable Filtering Controls

Apr 28, 2008

Hi,

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.

Kind Regards
Bal

View 7 Replies View Related

Forms :: Controls Not Repainting After VBA Routine

Jul 23, 2014

Access 2007

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.

View 8 Replies View Related

Forms :: Looping Through Subform Controls?

Aug 16, 2013

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 

View 10 Replies View Related

Forms :: How To Ungroup Controls On Form

Apr 29, 2014

I had never seen this before as I have recently moved from 2003 to 2010. When I create a from using the wizard sometimes the controls are grouped (inside a dashed square) which does not allow me to modify its size and/or position independently.

How can I "ungroup" these control?

View 2 Replies View Related

Forms :: How To Link Combo Box To Tab Controls

Jul 9, 2014

On my data entry Form, I have a Combo Box [Condition] and five tab controls. Each tab has as many as 10 controls on it. The purpose of the Form is to populate a table. My questions are:

1) Do I still need to use a subform on each Tab or leave them as-is? i.e. the 10 controls are on each tab

2) How do I make the value of [Condition] transfer focus to the appropriate tab??

View 14 Replies View Related

Forms :: How To Hide All Form Controls At Once

Apr 21, 2013

how to hide all form controls at once like if i have many text box and labels how to make a loop to hide it all at once

View 1 Replies View Related

Forms :: 2 Lookup Controls On One Subform

Aug 13, 2013

I have a library database with a form called Author and a subform from a junction table. The junction table connects Title/Genre. It's many to many because I usually have a few genres for one book.

This is my problem. I want to add more information to the subtable that is in the junction table. For every record I would like to add also Book Group (I am a member of several groups and want to remember which one I read the book with) and Purchased From.

So I am assuming I have to have 2 lookup controls to be able to add Book Group and Purchased from since neither one is on the junction table (and they both come from tables). Or do I add them to the junction table?

View 3 Replies View Related

Forms :: Hiding And Moving Controls

Nov 6, 2013

I have created a form with some boxes on it which include in their body textboxes and labels and combos. I would like to know if it is possible (or if a control exist) to group this items which are inside the box and with a simple box.visible = false to make them all non visible without tagging them or adding code with their names statically to make them non visible. Any link that shows how to move controls in the form in runtime?

I would like to hide some controls and make smaller the form and if user selects a checkbox to show these controls that exist inside a box and grow the form.

View 1 Replies View Related

Forms :: Linking Labels To Controls

May 17, 2014

I cannot link a label with a control. I don't know how it happens, or rather how I do it, but on various forms the label is not linked to the proper control. I try to do it by clicking on the warning popup on the right side and indicate I want to associate the label with the control, but sometimes it just doesn't work. That is, if I set the visibility of the control to True or False depending on the value of another control, the label still appears.

I've looked in the properties of each, but there doesn't seem to be anything there to indicate the link or association. Other than laboriously copying and pasting the label back on the form with the control highlighted, is there any way else to do this?

View 11 Replies View Related

Forms :: Referencing Controls On Subforms

Oct 23, 2014

In the attached picture has a representation of my setup.

My main form has a listbox search form (taken from this site). The search results populate data in subform1.

In the detail section of main form has subform1 with 3 cascading combo boxes. I have queries set up that run the cascading combo boxes.

In the detail of subform1, I have subform2 with a combo box.

Today I decided to merge my search form and the other forms so I wouldn't have two pages. Everything used to work with no errors - but I can't figure out how to reference everything properly now.

I've tried every combination from here to reference things properly. Somehow, I'm missing something.

View 12 Replies View Related

Forms :: Repeating Controls In A Form

Jan 7, 2014

I have a form that uses VBA codes to write all the info from the controls in the form into different relational tables. I was stopped at the point that I wanted to have repeating controls. Collect multiple instances of the same type of data, such as in the case of writing many people's Name, Age and Specialty in the Employees table. How do I do that? What is the VBA code for this task?

View 1 Replies View Related

Forms :: How To Format The Form Controls

Jun 27, 2015

Which option in property window is responsible for group lining up of some controls vertically? how to ungroup them to allow resize one individually. I could not also find option in menu for removing pre-formatting of those controls.

View 3 Replies View Related

Forms :: Mouse Scroll And Tab Controls

May 8, 2014

I have a form with four pages and subforms on each page. I am having issues with scrolling on pages 2-4. The first page will scroll correctly (to the bottom of the form), but the other pages will not scroll at all. I did enable the scroll bars on the subforms, but they will only scroll to the bottom of the viewable form, not the whole form, which I would prefer. Is there a way to scroll through the whole form on pages 2-4? I tried setting the focus to the form itself, but my code didn't work:

Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As Long)
Me.Parent.FRM_TABLE_TAB_1.SetFocus
End Sub

I would change the form; however, it is designed to look exactly like the actual questionnaire.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved