A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Creating matching record



 
 
Thread Tools Display Modes
  #1  
Old February 1st, 2010, 03:17 PM posted to microsoft.public.access.forms
JCA
external usenet poster
 
Posts: 8
Default Creating matching record

My database is essentially a set of data entry forms (for a clinical trial).
When a button at the bottom of each form is clicked, the next appropriate
form in the sequence will open. I have things set up so that the next form
opens at the appropriate record (i.e. the record with the Participant ID
value the same as the Participant ID value in the record just completed in
the previous form) if this record exists, but the fundamental thing which I
can’t work out how to do is to create this record (i.e. a new record with the
appropriate Participant ID) if it does not already exist.

Any help very gratefully received!
  #2  
Old February 1st, 2010, 03:56 PM posted to microsoft.public.access.forms
Tom van Stiphout[_2_]
external usenet poster
 
Posts: 1,653
Default Creating matching record

On Mon, 1 Feb 2010 06:17:01 -0800, JCA
wrote:

In all cases I would open the next form with:
DoCmd.OpenForm "myNextFormName", OpenArgs:="ParticipantID=123"

Then in Form_Open you can write (off the top of my head):
dim lngParticipantID as long
lngParticipantID = Split(Me.OpenArgs, "=")(1)
with me.RecordsetClone
.FindFirst "ParticipantID=" & lngParticipantID
if .NoMatch then
RunCommand accmdRecordNew
Me.ParticipantID = lngParticipantID
else
Me.bookmark = .Bookmark
end if
end with

-Tom.
Microsoft Access MVP




My database is essentially a set of data entry forms (for a clinical trial).
When a button at the bottom of each form is clicked, the next appropriate
form in the sequence will open. I have things set up so that the next form
opens at the appropriate record (i.e. the record with the Participant ID
value the same as the Participant ID value in the record just completed in
the previous form) if this record exists, but the fundamental thing which I
can’t work out how to do is to create this record (i.e. a new record with the
appropriate Participant ID) if it does not already exist.

Any help very gratefully received!

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:18 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.