Hello.
I have a label on Form A with an onClick method that opens a new form (form B)
with the following code:
stDocName = "frmdocument_review_referral"
MsgBox "doc_review_id = " & Me![doc_review_id]
stLinkCriteria = "[doc_review_id]=" & Me![doc_review_id]
DoCmd.OpenForm stDocName, , , stLinkCriteria
The Form B works if the record exists in the database.. How do I create a
new record using the doc_review_id of form A when the record for Form B
doesn't exist.
Rohan.
Rohan - 03 Feb 2006 04:35 GMT
It's ok - I did it by using the default value of the doc_review_id on form B
to be set to the doc_review_id
value on form A.
Ta,
Rohan.
Naeem - 03 Feb 2006 11:27 GMT
in your code, add and If condition so if the doc_review_id is null then you
open the form with no criteria, and then use. docmd.gotorecord like
docmd.GoToRecord acActiveDataObject,,acNewRec
the condition code can be like:
if isnull(me.doc_review_id) = true then
stDocName = "frmdocument_review_referral"
MsgBox "doc_review_id = BLANK"
DoCmd.OpenForm stDocName
docmd.GoToRecord acActiveDataObject,,acNewRec
else
"your normal code"
end if
> Hello.
>
[quoted text clipped - 12 lines]
>
> Rohan.