At 18:15 we see the appointments for Kirk and Picore. What we don't see is adding a new appointment with the AppointmentF. The customer foreign key isn't added, so we have to copy and paste or type it in (I see the download added a combobox). Is there a way to have it populated when doing a new appointment for the filtered customer (instead of using a combobox {where an error can be made in selecting the wrong customer})? Is there a better way to do all this with VBA instead of a macro?
(I like the idea of a separate form instead of cluttered forms with subforms, so this seems a natural to do.)
Yes Kevin, that would be the place, but how do we set the default value in the AppointmentsF when it's called from the CustomerF? We would probably like to disable the combobox if the appointments form is "called" from the CustomerF. But, if the AppointmentsF is run on it's own, then we want the combobox to be enabled. I'm guessing we need to ditch the macro the wizard built for the command button and get into some "easy-not scary" (ha ha Richard) VBA code.
Scott Axton
@Reply 4 years ago
Since you are opening a new form as opposed to having it as a subform you would need to use the
Forms!FormName!FieldName notation in the default value.
This assumes the underlying form is still open.
Thanks Scott, the problem as I see it, we need a way for the AppointmentForm to know if it was called from the CustomerForm. Then we can set the default value (based on your suggestion) and disable the combo box. We don't do this if the AppointmentForm wasn't called by CustomerForm.
Tip: As to how to handle SOME of the above questions, you can see the extended cut of:
https://599cd.com/blog/display-article.asp?ID=1386
And there is a Tip by Maggie there that I have yet to watch, but it too may be helpful for developers.
Scott Axton
@Reply 4 years ago
I'm not saying Maggie is correct, or not, but I fail to see how you can recommend her response as a good one based on the fact that you just admitted that you haven't watched it.
The solution I just gave you above takes into account what form you are calling from. By setting the default value to the ID from the calling form it sets the ID into the Appointment forms default value.
If you are opening the AppointmentF form from the CustomerF then the value is populated. By doing so that precludes opening the form else where without using some VBA to choose the value with a different method.
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Access Beginner 2.