473,788 Members | 2,743 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Detecting records present

OK, this is probably a dumb, newbie quesiton. But I've searched quite a
bit on this group and in the "help" files and haven't been able to find
the answer.

I run a crisis program for kids and families. I have a form that is
completed when a new person enters the program. The basic form includes a
client ID and demographic information with subforms for information about
the particular intake. Right now, you open the form in data entry mode and
start entering the demographic information. When you move to the subform,
the form will notify you that the record can't be saved because that
person is already in the database. What I want is for Access to tell me
that before I enter all the data. I'd like to enter the client ID (which
is the primary key for tblClient where this information is stored) and
have Access tell that person is already in the database rather than
waiting until I've entered all the data and am trying to move to the
subform.

Hope that makes sense. I assume I'd need some sort of AfterUpdate function
tied to the Client_ID field. Yes?

Thanks for any help. It's a small irritant, but one I'd like to fix before
other people start using this thing. I'm still pretty new to this.

Thanks again,

Randy
Nov 12 '05 #1
3 1695
Randy,
You need the before-update event of Client ID
Before_update can be cancelled so this is the event to validate.
So before_update you check if Client_ID is already present.
You can do this in several ways but perhaps DLookup is sufficient for the occasion.

If DLookup("[Client ID]", "tblClient" ,"[Client ID] = " & Forms!YourForm![Client ID]) > 0 then
Msgbox "Client already in db ..."
cancel=true
end if

BTW: Avoid using spaces in fieldnames.

--
Hope this helps
Arno R
"RM Powell" <no************ ****@charter.ne t> schreef in bericht
news:pa******** *************** *****@charter.n et...
OK, this is probably a dumb, newbie quesiton. But I've searched quite a
bit on this group and in the "help" files and haven't been able to find
the answer.

I run a crisis program for kids and families. I have a form that is
completed when a new person enters the program. The basic form includes a
client ID and demographic information with subforms for information about
the particular intake. Right now, you open the form in data entry mode and
start entering the demographic information. When you move to the subform,
the form will notify you that the record can't be saved because that
person is already in the database. What I want is for Access to tell me
that before I enter all the data. I'd like to enter the client ID (which
is the primary key for tblClient where this information is stored) and
have Access tell that person is already in the database rather than
waiting until I've entered all the data and am trying to move to the
subform.

Hope that makes sense. I assume I'd need some sort of AfterUpdate function
tied to the Client_ID field. Yes?

Thanks for any help. It's a small irritant, but one I'd like to fix before
other people start using this thing. I'm still pretty new to this.

Thanks again,

Randy


Nov 12 '05 #2
"RM Powell" <no************ ****@charter.ne t> wrote in message news:<pa******* *************** ******@charter. net>...
OK, this is probably a dumb, newbie quesiton. But I've searched quite a
bit on this group and in the "help" files and haven't been able to find
the answer.

I run a crisis program for kids and families. I have a form that is
completed when a new person enters the program. The basic form includes a
client ID and demographic information with subforms for information about
the particular intake. Right now, you open the form in data entry mode and
start entering the demographic information. When you move to the subform,
the form will notify you that the record can't be saved because that
person is already in the database. What I want is for Access to tell me
that before I enter all the data. I'd like to enter the client ID (which
is the primary key for tblClient where this information is stored) and
have Access tell that person is already in the database rather than
waiting until I've entered all the data and am trying to move to the
subform.

Hope that makes sense. I assume I'd need some sort of AfterUpdate function
tied to the Client_ID field. Yes?

Thanks for any help. It's a small irritant, but one I'd like to fix before
other people start using this thing. I'm still pretty new to this.

Thanks again,

Randy

Hi Randy. You need to place the code in the Before Update event
procedure of the ClientID control. Something like this should do the
trick.

Private Sub ClientIDControl Name_BeforeUpda te(Cancel As Integer)

If DCount("[ClientID]", "YourTablename" , "[ClientID]= '" &
Me![ClientID] & "'") = 1 Then
MsgBox "The Client ID you have entered is a duplicate"
Me.Undo
Cancel = True
End If
End Sub
Nov 12 '05 #3
On Thu, 27 Nov 2003 10:16:47 +0100, Arno R wrote:
Randy,
You need the before-update event of Client ID Before_update can be
cancelled so this is the event to validate. So before_update you check
if Client_ID is already present. You can do this in several ways but
perhaps DLookup is sufficient for the occasion.

If DLookup("[Client ID]", "tblClient" ,"[Client ID] = " &
Forms!YourForm![Client ID]) > 0 then
Msgbox "Client already in db ..."
cancel=true
end if

BTW: Avoid using spaces in fieldnames.


David and Arno,

Thanks for the help. I'll try it both ways. I figured you'd have to have
something in the control to tell it to look at the table for this.

Thanks again.

BTW: Sorry about the table name posting. It's actually Client_ID.

Thanks again,

Randy
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1581
by: Thomas Magma | last post by:
Hello, I have a case where an applet .class file may or may not be present. In the case when it is not present I get a big gray box where the applet is suppose to be. This is understandable, but undesirable when someone is viewing or printing the page. Is there a way to test first if the .class file is present before hand in order to avoid the big gray box. Thanks.
1
3062
by: Unregistered | last post by:
I'm making an Intranet site for someone who is not very familiar wit making websites, thus I would like to make it as simple as possible fo her when she needs to update it. The intranet site uses frames - one menu frame that is always present and one frame into which the content is loaded. The intranet sit features many, many links to both internal and external pages - i internal pages within the intranet and external pages on the...
12
4780
by: Wladimir Borsov | last post by:
On one of my web pages there is an java applets which works fine on my computer. However I noticed on some other computer that the run of java applets are disabled. I got an error message "Classnotfound" Is there a way to detect (with cgi resp. javascript) if java applets are allowed? I would like to show a simple picture instead of the applet pane if applets are not allowed. Wladimir
25
2922
by: Ryan Stewart | last post by:
I'm working on a project to collect web application usage statistics. What are the recommended ways of detecting whether a browser is JavaScript enabled and/or capable? Obviously I can write a script to invoke something on the server, and if it works, then it works. Is there a better way? I'm looking for the least intrusive way of doing it, from a web application point of view. i.e. I'd like to be able to drop this into an existing...
3
11274
by: Scott Leonard | last post by:
Hello - I'm writing an application that will be used on "sometimes connected" devices (laptops, tablets). In C#, what is the best way to detect whether a network connection is present? I'd rather not rely on a network request timing out - the detection process must be very quick. Thanks in advance,
1
24197
by: wwwords | last post by:
Is there a general method for detecting that a user has changed the record currently visible on a form, whether this is by hitting PgUp or PgDn or clicking on a navigation button, even if no change has been made in any control? I'm thinking of a situation in which a number of records have been entered on a form and the user is cycling through them to check the data entered. I want to be able to detect this and update certain information...
1
2230
by: poornimaniranjan | last post by:
Hello... I am new to VC++ environment..I am able to detect the CD-ROM drive using GetDriveType API . but this information is not enough for me. I need to know whether the drive is writer or reader. one more thing is i need to know whether CD is present in the drive or not please help me out Thanks poornima
3
1787
by: BASSPU03 | last post by:
I had to present my DB today, but was granted a chance to fix something about it. In order to fix something, I added something...something that is giving me more trouble than it should. I have to present again tomorrow. Quick assistance would be greatly appreciated. I have three forms (one main form and two subforms) with the following fields: frmResultsFY FiscalYear sfrmResultsAgencies FiscalYear Agency
15
4233
by: RobG | last post by:
When using createEvent, an eventType parameter must be provided as an argument. This can be one of those specified in DOM 2 or 3 Events, or it might be a proprietary eventType. My problem is testing for support of particular eventTypes - the DOM 2 Events Interface DocumentEvent says that if the eventType is not supported, it throws a DOM exception. This makes testing rather tough - if you try something like: if (document &&...
0
9498
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
10370
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10177
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
7519
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5402
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5538
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4074
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
3
2896
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.