473,766 Members | 2,026 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using filter value to default for new records

1 New Member
Clinic Visits form is done at 3,6,9,12,15,18 and 24 months. The same table (VISITS) is used repetitively during the study. Timepoint is recorded in the table variable VISMO (visit month). When we browse the form on a particular visit, let's say 6 month ie where vismo=6 we have this problem when we need to create a new record because we want VISMO to default to 6. Likewise we want VISMO to default to 12 when we browse the form where vismo=12. What's the method ?
(a) we created a "Public globalmo as Long" in Module1
(b) on the Form Load we have a statement "globalmo=Me.vi smo"
(c) in the Form Preview we have set the default value of vismo as "=(globalmo )"
(d) it doesn't work. Why ? Do we need to do things differently, like saving the loaded value of vismo in a hidden table ?

Alain
Aug 29 '06 #1
1 1978
MMcCarthy
14,534 Recognized Expert Moderator MVP
The default value is the value that a record is set to when it is created. It is also loaded with the form and cannot be reset after the form is loaded. However, you can set the value on the new record. If you have a command button to add a new record you can leave the code that assigns Me.vismo to the global variable where it is and put the following code after the new record has focus on the form.

Me.vismo = globalmo

Clinic Visits form is done at 3,6,9,12,15,18 and 24 months. The same table (VISITS) is used repetitively during the study. Timepoint is recorded in the table variable VISMO (visit month). When we browse the form on a particular visit, let's say 6 month ie where vismo=6 we have this problem when we need to create a new record because we want VISMO to default to 6. Likewise we want VISMO to default to 12 when we browse the form where vismo=12. What's the method ?
(a) we created a "Public globalmo as Long" in Module1
(b) on the Form Load we have a statement "globalmo=Me.vi smo"
(c) in the Form Preview we have set the default value of vismo as "=(globalmo )"
(d) it doesn't work. Why ? Do we need to do things differently, like saving the loaded value of vismo in a hidden table ?

Alain
Aug 29 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
18767
by: Ian Davies | last post by:
Hello all I have the following PHP script to place records from my MySql db into a table. However I now wish users to beable to select the multiple records from the table and on clicking a button the selected records are stored to another table in my db. I have started by including a check box in the first column but dont know the code necessary to check all the row in the table and copy the records of those boxes thats ticked Can anyone...
3
24035
by: Random Person | last post by:
Does anyone know how to use VBA to relink tables between two MS Access databases? We have two databases, one with VBA code and the other with data tables. The tables are referenced by linked tables in the database where the code resides. If we move the database with the data tables to a new directory, the links are no longer valid. I tried to update the links by changing the Connect property and refreshing: Set td = db.TableDefs(0)...
4
2493
by: Stewart Allen | last post by:
I'm trying to filter a table that has 2 date fields, the first date will always have a value but the second will only occasionally has a value. Each date field also has a corresponding text field to record the record's status. Sample data: *tblTest* Model Parts CDate CStatus RDate RStatus 616 $359.79 03-Nov-03 C
11
6600
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on where the job is running, the job runs sucessfully, PDF files got generated, everything is good. If I scheduled the job to run at the time that I am not logged into the server, Access is not able to print to the printer. The error is pretty...
2
2846
by: cefrancke | last post by:
I have a form (no underlying record set) that has two separate sub-forms on it. Each sub-form has data from two different tables. Above each sub-form there is one unbound combo box with a SQL record source that returns an ID field and a Text field. Next to each combo box is two buttons, one that 'Applys' the filter of the sub-form to the value in the combo box and one that 'Clears' the form's current filter. When the click event of the...
2
3166
by: Stu | last post by:
Hi, I've been working on trying to use a combo box to filter my records for a while now, and can't get it to work. Right now, I have SQL code written into IfThen statements on the afterupdate for the combobox. I tried using the docmd.runSQL but from looking at previous posts, it seems that I need to use DoCmd.OpenQuery instead since I do not have an action SQL statement. The short term problem is that when the user selects from the...
3
4046
by: google | last post by:
This is something I've done plenty of times in '97, but I can't seem to get it to work correctly in Access 2003. Say, for example, I have a form with an unbound combobox, the data source is a table of customers, first column is the key field, which is hidden with a 0" width, and the second column is the customer name. The SQL is a union query that also inserts Null in the first column, and "All" in the second column. That combobox gets...
3
11970
by: dhowell | last post by:
In reading some of the posts on this group, it appears as though it is not strait forward at all to filter a form, which has subforms, by criteria which are either on subforms or span more than one subform..... This MSDN article however makes it sound as simple as clicking "Filter by Form", entering the search criterial in the form and/or it's subforms, then just clicking "Apply Filter"...... ...
5
2655
by: Ron S | last post by:
After days of searching I finally an example that would work with my application, the only problem is after entering all of the code it is not working. Would someone be kind enough to take a look at this... Exmaple web site: http://allenbrowne.com/ser-62.html My Code: 'Purpose: This module illustrates how to create a search form, _ where the user can enter as many or few criteria as they wish, _ and results...
1
6799
by: woodey2002 | last post by:
Hi Everyone and many thanks for your time.. I am trying to begin access and a bit of VBA i am enjoying it but I have a annoying problem I just can’t get any where on. My databse mostly includes bits of code for different examples. I have one last thing to finish. I am trying to create a search form that will allow users to select criteria from multiple sources eg ,multi select list boxes , combo boxes. I have a subform showing all the...
0
9404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10008
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9837
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8833
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3929
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.