473,503 Members | 1,686 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access 2003: Comparing field in one table to another

23 New Member
Hi All,

I would like to know how do I compare one field in one table to another in another table. I have one table which is the Archive table. It keeps a history of everything, I have another table which is updated weekly. In both table there is a field called status. If the status of the field changes from last week then on the form I wanted the status field to be bold. I was thinking of something like

If tbl_weekly.status <> tbl_archive.status then
Tbl.archive.status.FontColor = vbRed

I know that’s not exactly correct but I hope it gives the idea. On the form I don’t know how this can be coded. Any guidance, advice or example would be great. Hope everyone enjoys the holiday.
Dec 24 '07 #1
2 2250
puppydogbuddy
1,923 Recognized Expert Top Contributor
Hi All,

I would like to know how do I compare one field in one table to another in another table. I have one table which is the Archive table. It keeps a history of everything, I have another table which is updated weekly. In both table there is a field called status. If the status of the field changes from last week then on the form I wanted the status field to be bold. I was thinking of something like

If tbl_weekly.status <> tbl_archive.status then
Tbl.archive.status.FontColor = vbRed

I know that’s not exactly correct but I hope it gives the idea. On the form I don’t know how this can be coded. Any guidance, advice or example would be great. Hope everyone enjoys the holiday.
Happy Holidays to you, also!

OK, let's assume that the textbox on the form that holds the weekly status is named txtStatus. Try placing this code in the current event of your form:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2. Dim strStatus As String
  3. ' the following syntax assumes that the linkfield is a numeric datatype. 
  4. strStatus = Dlookup("[Status]", "tbl_archive", "tbl_archive.[yourLinkfield] = " & Me!yourLinkToArchive)
  5.  
  6. If Me!txtStatus.Value <> strStatus Then
  7.     Me!txtStatus.BackColor = vbRed
  8. End If
  9.  
  10. End Sub
Dec 25 '07 #2
JC21
23 New Member
Thank you for the input puppydogbuddy, sorry for the late reply.
Dec 29 '07 #3

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

Similar topics

1
1939
by: Emilio | last post by:
(MS Access 2002) Hello, I'm working with some big Census (PUMS) files, and I run into a peculiar problem once the data field exceeds five integers. I'll explain every step, since I am doing it in...
8
20306
by: Vladimir | last post by:
Hello, I have a table in MS Access database. It has one field (with BYTE datatype) that has several properties set in Lookup tab of table Design View. Display Control = Combo Box. Row Source...
7
35663
by: Bob | last post by:
Currently I am using this statement to translate 3 fields in my db thru Visual Basic. I import the data from one table to another then call the IFF statements and the NewDate to translate the...
1
2146
by: edo | last post by:
Following is a summary of articles spanning a 7 day period, beginning at 12 Dec 2003 05:22:35 GMT and ending at 19 Dec 2003 04:09:06 GMT. Notes ===== - A line in the body of a post is...
5
2895
by: Prakash | last post by:
Hi, In my Access Report ... If there is "NO" entry i.e. (no corresponding CODE) in my Data-File, then even the Master-File entry does not show up in the report. eg. Mast-File Code Op.Bal
52
9914
by: Neil | last post by:
We are running an Access 2000 MDB with a SQL 7 back end. Our network guy is upgrading to Windows Server 2003 and wants to upgrade Office and SQL Server at the same time. We're moving to SQL Server...
13
5306
by: mfreeman | last post by:
The minimal code (VB.NET 2003) needed to show this problem is shown below. All I do is loop through the records in the table and update them without making any changes. Out of 600 records, about...
20
6880
by: hippomedon | last post by:
Hello everyone, I'm looking for some advice on whether I should break the normalization rule. Normally, I would not consider it, but this seems to be a special case. I have created an...
2
4748
by: steph | last post by:
I have a table with 250 fields. Of course you are wondering why 250 fields... what could I possibly be storing in so many fields? I am using this table as a general import table for files that...
0
7087
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
7281
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
7334
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...
1
6993
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...
0
7462
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...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1514
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 ...
1
737
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.