473,395 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Using filter value to default for new records

1
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.vismo"
(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 1965
MMcCarthy
14,534 Expert Mod 8TB
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.vismo"
(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
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...
3
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...
4
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...
11
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...
2
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...
2
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...
3
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...
3
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...
5
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...
1
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...

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.