Me.controlsource Not Retaining Value

Dec 13, 2007

I have a unbound text box being used as a label. In the control source of the text box I have a date ie. =#12/31/2008#. I am using this date for criteria in a dsum function, so whatever date is in this field effects the data being displayed. I need to be able to have the user edit this date when necessary. I created another unbound text box and put the following code in the after update: Me.ReestDate.ControlSource = "=#" & Me.EnterReestDate & "#"
This is working as it is displaying the correct change. My problem is that the control does not retain the date. When I exit out and go back in, the original date is still there. Is there some code that will save the field after I update it? Or maybe another suggestion to do what I need.
Thanks
Gregg

View Replies


ADVERTISEMENT

Help With DLookup And ControlSource??

Aug 19, 2004

I am trying to set a ControlSource for a textbox to a string what is the correct syntax?? I am also trying to set a record source using DLookup, this is also not working. Could some look at my syntax an correct me.

Reports(!strReportName)!txtClientName.ControlSourc e = "All"

Reports(!strReportName)!txtClientName.Value = _
DLookup("[ClientName]", "CLientIDs", "ClientNumber = '" & _
Forms!frmReport!txtCustom1 & "'")


thanx

View 2 Replies View Related

Setting Controlsource Propert In VBA

Jan 28, 2008

I am trying to set the controlsource propert within VBA for a combo box

S_SECTCOSTCENTRE is the field name I want to set.

My syntax below doesn't work can anyone help



cmbcostcentre.ControlSource = "S_SECTCOSTCENTRE"

thanks paul

View 1 Replies View Related

Changing ControlSource Binding

Aug 29, 2005

I have a form. The form is bound to an underlying query which is a left join between two tables. (SELECT ... T1 LEFT JOIN T2 ON T1.RID = T2.RID ....)

Now, what I want to happen is the value in T1.RID does have a match in T2, then I want a sequence of text controls to be bound to fields from T2, otherwise I want them to be bound to fields in T1.

I almost have it working. I have Form_Current() and T1_RID_Change() both calling a routine

sub BindControls()
if isnull(T2_RID.value) then
txtField1.Controlsource = "T1.Field1"
txtField2.Controlsource = "T1.Field2"
' etc for each field
else
txtField1.ControlSource = "T2.Field1"
txtField2.ControlSource = "T2.Field2"
' etc for each field
end if
end sub

The problem is that when I change the value in T1.RID, most of the times it does change the controlsource appropriately. But other times it lags. It keeps the wrong controlsource until I try changin RID again, and sometimes the text boxes are just blank, so I am not sure what is going.

Am I ultimately going to be able to make this scenario work?

Thanks,
David

View 2 Replies View Related

Changing Controlsource At Run TIme

Feb 20, 2008

I want to design a common Search Form which should read records from different table sources and populate a sub-form depending on the user preference. The recordsource of the form should change to point different table or query name depending on user option.

Similarly, the underlying text controls should have their control sources changed to appropriate field in the table selected.

How is this done in run time.

For example, I have two tables and forms (1) for Currency (t_CurrcyMas) and (2) for User details (t_USerMas). I have search form named frmSearch. This has criteria defined as txtCri1, TxtCri2. Depending on the entry of criteria, matching records should be displayed as continuous form in two text controls named txt1, txt2 under sub-form frmSubSearch. The recordsource of the form.frmsearch should be changed to t_CurrcyMas and control sources of Txt1, Txt2 to be changed.
WHat is the syntax for this, and in what event do I insert the codes.

View 5 Replies View Related

SubSubForm ControlSource/RecordSource Problem

Nov 4, 2005

I have a form with two subforms. One of the subforms has five subforms (subsubforms).

The ControlSource and the (query sequence for each) RecordSource of each of the subsubforms are created on-the-fly. The subsubforms have no Master/Child relationships specified. The subsubform merely display various filtered and various grouped subtotals of the 1st subform. Summing and grouping on the subsubforms prevents my using Master/Child properties.

On the AfterUpdate event on any of the filter fields on the form the ControlSources and RecordSources are rebuilt and the form becomes invisible for some reason and appears to hang, even after stepping through all the (class module) code with the debugger. Repeadedly clicking both Maximize and Restore buttons on the form's button on the Status Bar followed by clicking a 2nd form's toolbar icon causes the form to become visible under the 2nd form. The tool bar are also not visible, just a large brow bar at the top of the form. Moving the mouse over the toolbars causes individual icons to become visible or raised.

What am I missing?

Maybe I should calculate the values using DAO recordsets and backfill unbound subsubforms.

Thank you in advance for your thoughts.

View 1 Replies View Related

Need To Update A Field Based On Selected ControlSource

Mar 31, 2008

I have a combobox that selects the customer and shows related information on that customer such as phone number, cc#, etc..

now the trick is i need to allow the selected member to be added to the order information.

For instance, the user selects the customer "Bob" and bobs information is displayed to check for accuracy. After the info is approved the user will continue to process his order. In order to do this I need the customer ID to be the same as the selected customer in the combobox.

Then the user will proceed to fill out the order information, location, date, time, etc.

How can I go about doing this?

Thanks in advance

View 2 Replies View Related

Modules & VBA :: Setting ControlSource To Sum Shows Error

Feb 2, 2014

In my application I have continuous form with unbound textbox. In OnOpen form event I change ControlSource property of textbox to one of the fields (e.g. "Kol921") in forms recordset. In form footer I have another unbound texbox where I defined ControlSource property as "=Sum([Kol921])".

Values in fields shows correctly, but in "sum" textbox I get Error.

When I get through code in debugging mode (with F8 key), value in "sum" texbox shows correctly, but when I open form normally I get an Error in that textbox.

Here is part of code:
Me.Controls("mat1").ControlSource = "Kol921"
Me.Controls("mat1").Visible = True
Me.Controls("matSum1").ControlSource = "=Sum([Kol921])"
Me.Controls("matSum1").Visible = True

View 2 Replies View Related

Modules & VBA :: How To Change Controlsource Of Multiple Textboxes With Public Function

Jun 11, 2013

I have multiple reports that use similar IIF statements as the controlsource for four textboxes. Naturally, I don't want to have to update twelve controlsources if any of the calculations change, so I thought I'd make this a public function. However, I don't know how to pass along multiple textboxes as variables. Here's what I have so far:

Code:
Option Compare Database
Public Function txtColor(ByRef textbox As Control)
Dim str1, str2, str3, str4 As String
'The IIf statement is simplified for this example. It's not important.
str1 = "=IIf(IsNull([Inquiry start date]),'W',IIf([txtInquiry]<1 And IsNull([Inquiry end date]),'R'))"

[Code] ....

And this is in the report (where ??? is what I'm asking about)

Code:
Private Sub Report_Load()
Call txtColor(???)
End Sub

The error I get is "Runtime 424 Object Required"

View 7 Replies View Related

Retaining Leading Zeros

Jun 22, 2005

I have a query and i want to join 2 fields together

eg. JOB:[Type_id] & [Number_id]

this works fine but i need to put an input mask on the field

type id is 2 letters
number id is 4 numbers (0001)

however whan the filed JOB is created all leading 0's from Number id are lost

how can i prevent this

RICKA

View 2 Replies View Related

Retaining Order Of Records

Nov 10, 2006

Hi, how do I retain the order of my records in a table in terms of when added ie

1st record id = 3456
2nd record id = 1234
3 rd record id = 2456

but when i go into the tabel it is now in order of 1234, 2456, 3456...i dont want numerical ordering!!

Cheers

Tania

View 1 Replies View Related

New Record With Retaining Information

Oct 13, 2015

How to code this button so it creates a new record while retaining information such as a serial number. So if you pull up the item check out its past service. then you want to click a "new entry" button but you want the serial number to remain in the field.

What I got so far is:

Private Sub BtnAdd_Click()
On Error GoTo Err_BtnAdd_Click
DoCmd.GoToRecord , , acNewRec
Exit_BtnAdd_Click:
Exit Sub

Err_BtnAdd_Click:
MsgBox Err.Description
Resume Exit_BtnAdd_Click
End Sub

But obviously it erases the serial number.

The field is txtSerialNumber and the control source is SerialNumber.

View 7 Replies View Related

Retaining Text In A Click Action

Jul 6, 2006

I have two fields set up on a form, when the user double clicks in field 1, the text that was in Field 1 then moves to field 2. The issue is that the text in field 2 only retains the most recent text change - overwriting the text that was in field 2 previously. How do i make it so that every time the text moves to field 2, that it keeps a running history of the text?

View 1 Replies View Related

Merging Tables And Retaining Data

Oct 19, 2004

Newbie here,
i have two tables with 3 fields in each (code, Description and amount)
what i need to do is join these two together to show data from both tables (some of the
data in fields one and two will be identical, but the third fields in both
tables will need separate entries for each table)
the primary key would be the first field (code) ysee, the original table has been updated
by a n other, some codes and descriptions changed for others so, i would like to end up with
feild one, all codes from both tables, field two,
all descriptions matched to codes from both tables,
field three numbers matching from first table, field
four numbers matching from second table.

is this a possibility?

please help...loosing hair!

Paul

View 14 Replies View Related

Forms :: Retaining Drop Down Value For Next Record

Apr 27, 2015

After choosing a dropdown value and filing in other required fields, I click Add Record. Is there a way to retain the same value in the dropdown list assuming it will often be the SAME AS dropdown value (e.g., the same customer) of the record I just added?

View 14 Replies View Related

Retaining Foreign Key Values After Data Input

Nov 11, 2005

Hi

I want to be able to invoke a form from a main form that allows me to add, delete or amend records in a table related to the one updated by the main form.

As many details records are being updated, I want to retain the value of a couple of foreign keys (but be able to amend them if required) based on the value of the previous record.

I have looked at the Dlookup function and wonder if this is what I should be using. If it is, I am having trouble trying to understand how you could differentiate between the first invocation of the pop up form and any subsequent table entries. The way I understand this function is that to get the value of the previous record in the table you use "ID-1", but this would almost certainly lead to an error for records being updated for a new master record, or if the table happended to be empty then there would be no ID-1 record.

Any help would be greatly appreciated.

Thanks

View 3 Replies View Related

Record Not Retaining/storing Combo Box Selection

Mar 9, 2006

hi,

i have a form that uses combo boxes for entry, some of the combo box entries are dependent on preceding combo box selections.

i have managed to make the combo boxes present options based on the previous selections, but am finding that after i move on to another record, some of the combo box entries are not being retained or stored in the record.

It happens only on some records and sometimes when I return to it again the selections are there even though on a previous ocassion they were not.

Can anyone suggest what may be causing this?

Regards

K

View 5 Replies View Related

Table Not Retaining Data From Form - Access 97

Oct 28, 2004

Hi,

I'm relatively new to Access and have just created a database and am wanting the database to calculate the total of two fields and store this information in the underlying table.

Example:-

Field 1 - £10
Field 2 - £15
Field 3 - TOTAL of above - I have used the calculation =([Field 1]+[Field 2])

This works fine in my form but the total value doesn't fall through to the table. It is just blank.

I am using Access 97 and wonder if this is somehow possible. I have attached a screen shot of the properties for this field (which is called 'Total' in the underlying table).

Any assistance would be appreciated.

Thanks,
Dean.

View 1 Replies View Related

Retaining A Value Entered Throughtout The User's Session

Nov 13, 2006

I am creating a database to track a student's course load in a degree program.

When the student enteres their ID on the first form I want to retain that value so subsequent forms and views display their records, or allow new entries/updates to different tables without re-entering their ID. I'm having no luck passing the value entered into the first form's text box to other processes selected prior to closing out the database.

Thank you.

View 3 Replies View Related

Modules & VBA :: Public Boolean Variable Not Retaining Value

Oct 9, 2014

I have a backup subroutine which automatically triggers when the front-end is closed down (it just takes the back-end, makes a copy and compacts it).It's driven off a hidden form which I use to track who is connected to the BE at any given time. This form is opened as part of the AutoExec when the FE is opened and writes some basic user info to a table. When the form is closed, it updates the table and fires the backup process before quitting Access.

Part of that user tracking process checks to see if the same user is already connected - either elsewhere (i.e. on a different machine) or on the same machine (i.e. opening a second instance of the same FE) - which is undesirable (and, frankly, unlikely, but not impossible) A brief prompt appears to explain that they can only be connected once, at which point the application is quit (to enforce the rule) This also works fine.

I would add a public boolean variable, set it to True by default, then switch it to False if the same user is already logged on before quitting Access.Trouble is, the variable doesn't seem to be holding its value? Here is the Load event for the tracking form :

Code:
Private Sub Form_Load()

On Error GoTo ErrorHandler

Dim dbs As Database
Dim rst As Recordset
Dim strSQL As String
Call InterfaceInitialise
blnPerformBackup = True

[code]...

For some reason, blnPerformBackup is False every time, even though I set it to True at the very start of the Load event (and it is a Public variable, defined in a separate module where I store all my Public constants and variables)

why it is not retaining its value from the Load event? I've checked and it does get set to True - and when I debug, it remains True - but at runtime it reverts back to False by the time it reaches the decision whether to backup or not?

View 9 Replies View Related

General :: Import Data To Excel From Access Without Retaining Link

May 11, 2015

Is there a way to import data to Excel from Access without retaining the link ?

I have a table and two queries (from that table) that I wish to export to a specific (Templated) Excel file.

I want to send the data to the Excel file then be able to subsequently copy and paste and email the file without any data connections etc.

Alternatively : to export from Access to the templated excel file.

View 2 Replies View Related

Retaining Data Items In Previous Entries After Item Has Been Discontinued

Jul 7, 2013

I seem to be have trouble resolving an issue whereby data entered via a combo box based on another combo box from separate tables/queries is not able to be retained when the data in the original table has been "discontinued". The database in question has changing items that are continually updated and/or discontinued. However when these items have been checked as "discontinued", the old entry data is then updated and the fields are empty.

View 1 Replies View Related

Convert Text (YYMM) To Numeric Retaining Lead Zero Or Zeros (Year 2000)

Aug 28, 2012

I have a DB containing over 4 million rows of data, each with a SALES_PERIOD based on YYMM. Our Developers set it up as Text, and index this item accordingly, I would like to format as numeric with the lead zero to allow quicker indexing, but when I format it it returns to text this is the formula I use?

Format((Val([SALES_PERIOD])), "0000")

View 5 Replies View Related







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