which form called me ?

saleemMSMS

Registered User.
Local time
Tomorrow, 05:27
Joined
Aug 12, 2009
Messages
92
hi
i have 3 forms form A, B and C
for A and B have combo boxes each which are having values which are being entered through form C
eg: books and articles have authors
all the authors are stored in one table which has form C to enter data
the books form (form B) has a combo box filled with authoru names and has a link to the author form as well
the magazine form too has a combo box filled with author names and has a lki k top the author form
when a new author is been entered, what i did was required the calling form's relevant combo box. in the after update event of the author form

but i don't know the way of finding which form called the author form

how can i do that ?

eg:-
if books form called author form, the the requery should happenonly to the books form's author combo box. and vise versa to magazine form
how can i do this checking ?
 
Are all these forms open at the same time? Or is one for opening another form, then when the form that has been opened is closed focus goes back to the referring form?
 
nope they are not opened at the same time.. i mean the forms books and magazines are not opened same time..
but
- books and authors
- magazines and authors
those 2 combinations are possible...
 
The following code is used in the On Double Click Event of a Combo to open a form to add additional records to the table that is populating the combo box. When the form is closed the referring Combo is requeried.


Code:
    Dim lngcombo7 As Long

    If IsNull(Me![YourComboName]) Then
        Me![YourComboName].Text = ""
    Else
        lngcombo7 = Me![YourComboName]
        Me![YourComboName] = Null
    End If
    DoCmd.OpenForm "FRM_NameOfFormToAddNewValue", , , , , acDialog
    Me![YourComboName].Requery
    If lngcombo7 <> 0 Then Me![YourComboName] = lngcombo7

Is that what you are looking for?
 
yeah its pretty neat
but the first part is confusing... (the if condition thingy)...i mean there an error saying that "you must enter a value in the <combo box> field
 
Set up the combo with Limit to List = Yes

Then in it's On Not In List event put the following or similar;


Code:
MsgBox "Double-click this field to add an entry to the list."
Response = acDataErrContinue
 
hmm,. still the error comes.
the exact error is
"you must enter a value in the <combo box name> field"
the On Not In List event works well if i type something and try to loose focus... but the text assigning from the if event doesn't seems to fire the On Not In List event....
 
The code is lifted directly from one of the DB templates available from Access. That first piece of code is simply designed to clear any text that may already have been entered in the combo.

Have a look at the attached for a working example.
 

Attachments

hey, another small thing;
when i open my form in the dialog mode, it doesn't show up in the correct dimensions i mean the height and the width of the form is reduced. ...
any idea how to make it correct ?
btw, i'm using Access 2K3

also regarding the If clause, it seems that work without that "IF checking" ...but gives a run time error only if no values are in the combo box and if u didn't enter any at the dialog box appeared. other than that, its smooth. maybe an error traping will work... :)
 
n another problem is, whenever user have done with the updating part, then they will go back to the previous form, the last data still not in the list. means, the combo box is still not updated. why?
 
This portion of the code
Code:
Me![YourComboName].Requery
in post #4 is the part that should re-query the combo when the form used to add the new record has closed.

If this isn't working you may need to post a copy of your DB.
 
n plus, why theres still an error? i have 5 combo box to do the same thing. the 1st was ok. but the rest was not ok. shud i change something in my coding?
 
okay i think now i know why. if i just type in the vb window, there for sure the error will appear. i need to type for each. thanx a lot john. u helped me a lot
 

Users who are viewing this thread

Back
Top Bottom