Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / February 2006

Tip: Looking for answers? Try searching our database.

openForm new record problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rohan - 03 Feb 2006 01:20 GMT
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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.