Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Posts
    20

    Unanswered: Need urgent Help

    Option Compare Database




    Function IsLoaded(ByVal strFormName As String) As Boolean
    ' Returns True if the specified form is open in Form view or Datasheet view.

    Const conObjStateClosed = 0
    Const conDesignView = 0

    If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> conObjStateClosed Then
    If Forms(strFormName).CurrentView <> conDesignView Then
    IsLoaded = True
    End If
    End If
    End Function

    Private Sub cmd01_Click()
    DoCmd.OpenForm "Admissions", , , , acFormAdd
    DoEvents
    If IsLoaded("Admissions") Then
    Forms![Admissions].txtPatientID2 = Me.txtPatientID
    End If
    End Sub

    this vb coding is to copy data in the patientid field to the patientid field in another form....however i need it to also close the patient form aswell as copy...therefore i all i need is the coding that will close the form once the button clicked!!!
    thanx!!!

  2. #2
    Join Date
    Mar 2004
    Location
    Nashville, TN
    Posts
    557
    The code to close a form is as follows.

    Code:
    DoCmd.Close acForm, "yourtitlehere"
    Hope this helps,
    JS
    Have you ever thought about thinking on purpose?

    Jarvis Stubblefield
    Patriot Designs
    Web/Database Development and Consulting
    The-Patriot.net by Patriot Designs

  3. #3
    Join Date
    Mar 2004
    Posts
    20
    Originally posted by JSThePatriot
    The code to close a form is as follows.

    Code:
    DoCmd.Close acForm, "yourtitlehere"
    Hope this helps,
    JS
    can u put that in for me..where ever that goes because i dnt know where to put it in...the form is called Patient

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Originally posted by RohitSaini
    can u put that in for me..where ever that goes because i dnt know where to put it in...the form is called Patient
    This is not your code then eh?



    it goes at the very end.

  5. #5
    Join Date
    Mar 2004
    Posts
    20
    Tahnx it worked....this forum is the biggest help anybody could ever get....people on this forum know 10* more than what my teacher knows!!!anywaysz peace to all y'all...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •