[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bump::msaccess

Title:MSACCESS
Moderator:BUMP::HONER
Created:Tue Dec 01 1992
Last Modified:Mon Jun 02 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:1661
Total number of notes:6339

1635.0. "Newbie: Difficulties with "IsLoaded" function" by KANATA::ZUTRAUEN (always lookin' to learn) Wed Feb 26 1997 15:22

     I am in the midst of creating a very simple data-base which has a main
    form (MainData) containing  a  combo-box (SupplierName) which opens a
    secondary form (Suppliers) to add new supplier details using the
    combo-box's NotInList function. Following the "Solutions" example, I
    have put the following into the Unload Event of the secondary
    (Suppliers) form, to update the combo-box (SupplierName) on the main
    (MainData) form upon return:
    
    
    Private Sub Form_Unload (Cancel As Integer)
    
     '  If MainData form is loaded,
     '  select it, requery SupplierName combo box,
     '  and set value of the SupplierName combo box.
    
     Dim ctl As Control
    
     If IsLoaded("MainData") Then
      Set ctl = Forms!MainData!SupplierName
      DoCmd.SelectObject acForm, "SupplierName"
      ctl.Requery
      ctl = Me!SupplierName
     End If
    
    End Sub
    
    My problem is that upon exiting the "Supplier" form, the If IsLoaded
    condition is for some reason not met, even though the MainData form is
    still displayed (without focus of course). I checked my form settings
    with the settings in the "solutions" database, but could find no
    discrepencies. If I remove the condition altogether, I then get an error 
    message:
    
    Run-time error '2118':
    You must save the current field before you run the Requery action
    
    
    I am not shure what field the above message is referring to......
    Of course the "solutions"  example works flawlessly.....
    
    Could anyone out there point me to what I am doing wrong?
    
    Your help is very much appreciated!
    
    Thanks,
    Pete  :-)
    
    
    
    
    
T.RTitleUserPersonal
Name
DateLines
1635.1Try to save entered data firstNSIC00::KLERKThunderbirds are GoSun Mar 02 1997 14:539
  You may want to use the SaveRecord command first to flush the data in your
  2nd screen to a table before requerying this table from the main form.

      If Me.Dirty Then
         DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord
      End If

  Theo		 
1635.2thanks, but i've still got it screwed up.... :/KANATA::ZUTRAUENalways lookin' to learnMon Mar 03 1997 10:0811
    Hi Theo,
    
    Thanks for the help..your suggestion makes perfect sense...tried it,
    but still no joy....
    
    I have seen another couple of folks on the web newsgroups with the same
    problem.... I'm shure it's something simple we are all doing wrong with
    the table relationship or form set up, or .......but what???
    
    Thanks again,
    Pete  :)
1635.3'twas a bug (naaa, really? :)KANATA::ZUTRAUENalways lookin' to learnMon Mar 03 1997 16:0712
    aha! a V7 Bug....
    
    had to repeat the line:
    
    DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
    
    twice  to get it to work.... (V7 Bug, as far as another newsgroup
    writer is concerned).
    
    Thanks for the help,
    Pete