473,326 Members | 2,108 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,326 software developers and data experts.

how can i check to see if record is already there.

I have a form in access that lets the user enter data. The data is information taken over the phone from a caller about someone who has committed a liter violation. Once the data has been entered the user hits the send letter button and it prints a letter in word to send a warning to the violator. I need the code to run a check to see if that violator already has a record.
When the user enters the data, i need for it to tell me that this person already has a record if one is there for them. and give a "second warning" message.

here is my code for the send letter button.
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmd_Send_Click()
  2.     'checks to see if both checkboxes are checked (Letter Sent & 2ndWarning)
  3.     If CkSentBoxesNone Then Exit Sub
  4.     'checks to see if Do Not Send checkbox is checked - If true, give msgbox warning
  5.     If CkDoNotSend = True Then Exit Sub
  6.  
  7.     PrintWarningOne
  8.  
  9. End Sub
  10.  
  11.  
  12.  
  13. ' insures both LetterSent & 2ndWarning checkboxes aren't BOTH unchecked
  14. Private Function CkSentBoxesNone() As Boolean
  15.  
  16.     If ([Forms]![frm_Input_frm]![LetterSent] = False) And ([Forms]![frm_Input_frm]![2ndWarning] = False) Then
  17.         MsgBox "You must check either ""Letter Sent"" or ""2nd Warning"" checkbox " & vbCrLf _
  18.         & "for this call/violation." & vbCrLf & vbCrLf _
  19.         & "Please choose only one checkbox.", vbOKOnly, "Choose One Checkbox"
  20.         CkSentBoxesNone = True
  21.     Else: CkSentBoxesNone = False
  22.     End If
  23.  
  24. End Function
  25.  
  26. ' checks to ensure Do Not Send box is not checked when a letter is generated
  27. ' if it is, a MsgBox warning is issued but user can override and still print
  28. Private Function CkDoNotSend() As Boolean
  29.  
  30. Dim response As Integer
  31.  
  32.     If [Forms]![frm_Input_frm]![DoNotSend] Then
  33.         response = MsgBox("The ""Do Not Send"" box is checked on this record. " & vbCrLf & vbCrLf _
  34.         & "Are you sure you want to print this letter?", 36, "Do Not Send Checked")
  35.         If response = 6 Then
  36.             CkDoNotSend = False
  37.             Else: CkDoNotSend = True
  38.         End If
  39.     Else: CkDoNotSend = False
  40.     End If
  41.  
  42. End Function
Oct 20 '09 #1
1 1433
ChipR
1,287 Expert 1GB
We would need some more information. If you have a table of previous violations, you can simple use a DLookup on the primary key. If it returns null, then there is no existing record.
Oct 22 '09 #2

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

Similar topics

3
by: Josh Armstrong | last post by:
I need a form to check for duplicates before a new record is added. Table name: Links Field1: LinkSysNum Field2: SysNum For example, =539 is linked to =540 =544 The db is setup using a...
5
by: Notgiven | last post by:
You want to check scheduling conflicts and you have a record like: appointments(table): apptID beginningDate endingDate beginningTime endingTime It's easy enough to check if a time is...
6
by: Jack | last post by:
I have a main webpage that has a list of records, each with a link to a window.open function call. As an example, a page that opens is editrecord.aspx?RecordID=34, and another is...
3
by: byeung | last post by:
Hi, I am trying to check if a particular record already exists in an Access database through Excel vba code. Through code obtained at another forum, I got the following: ...
9
reginaldmerritt
by: reginaldmerritt | last post by:
I have a table which uses two primary keys. One is a canidate code the other is a course\programme code. I have a fom with these two fields but automaticaly picks the candidates code. Therefore...
5
by: Gilberto | last post by:
Hello I created a form where the user has to enter some information which will change over time. Every time the user fills up a form, the time and date are recorded. I have the problem that if...
2
by: thatguyNYC | last post by:
Hello-- I have a form that lets the user edit the values in a lookup table. The form is bound to a table and has one textbox on it. The record nav buttons are enabled. On the top half of the...
1
balabaster
by: balabaster | last post by:
Hi guys 'n gals, I'm having an issue wrapping my head around a check constraint that I need to set on a table in my database. Table: OnCall Columns: OnCall_PKey (identity), Person_Key,...
2
by: Ranma13 | last post by:
Hello, I have a duplicate record check written in VB for a check in/check out database. Here's the pseudocode, written for the BeforeUpdate property on the form: If DCount(search for records with...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.