A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

open form only when necessary



 
 
Thread Tools Display Modes
  #1  
Old June 9th, 2004, 03:44 PM
Scott
external usenet poster
 
Posts: n/a
Default open form only when necessary

I'm moving into new teretory by creating my most ambitious form yet. Perhaps
it'll be a piece of cake for you experts

If you've used Quicken and the Online Payee list then you'll be familiar
with what I'm trying to do. In Quicken, if you enter a payment and indicate
"Send" and then enter the Payee name, if the Payee doesn't yet exist then a
form opens up where you can enter the Payee name, address, account and
telephone number.

I want to do the same thing in my new Access form. On the parent form I want
to do a lookup on the customer id field [CUID]. If the customer hasn't been
entered in the Customer Master table yet then I'd like the option to open a
child form to create a new customer record.

Any suggestion on how I can do this or where I can read more about forms
like this?

Scott


  #2  
Old June 9th, 2004, 04:04 PM
Kevin Sprinkel
external usenet poster
 
Posts: n/a
Default open form only when necessary

Hi, Scott. Piece of cake.

The approach is:

- Open a data entry form (i.e., Data Entry property = Yes).
- Enter the new customer record.
- Close the data entry form, returning to the original.
- Requery the CustomerID combo box to include the new
record.

Search VBA Help for:

- OpenForm method
- DoCmd option (DoCmd.Close to close data input form)
- Requery method

HTH
Kevin Sprinkel

I want to do the same thing in my new Access form. On the

parent form I want to do a lookup on the customer id field
[CUID]. If the customer hasn't been entered in the
Customer Master table yet then I'd like the option to open
a child form to create a new customer record.

Any suggestion on how I can do this or where I can read

more about forms
like this?

Scott


  #3  
Old June 9th, 2004, 04:13 PM
tina
external usenet poster
 
Posts: n/a
Default open form only when necessary

if you're looking up the customer id from a combo box in the form, here's
some *sample* code that may help you:

Private Sub MyComboBox_NotInList(NewData As String, _
Response As Integer)

If MsgBox("Do you want to add a new customer to the list?", _
vbDefaultButton1 + vbYesNo) = vbYes Then
strColor = NewData
'NOTE: the form that opens must be Single Form view, or
'Continuous Form view. It cannot be Datasheet View.
DoCmd.OpenForm "MyForm", , , , acFormAdd, _
acDialog
Response = acDataErrAdded
Else
Response = acDataErrContinue
Me!MyComboBox = Null
Me!MyComboBox.Dropdown
End If

substitute the correct names of your combo box and 'add customer' form in
place of "MyComboBox" and "MyForm", of course. when the user enters an ID
that doesn't exist, the code asks a new customer should be added. if the Yes
button is clicked, the add form opens and the code is suspended. when the
add form is closed, the code resumes, automatically requerying the combo box
to include the new customer id. if the No button is clicked, the entry in
the combobox is erased and the droplist opened, so the user can start fresh
in that control.

hth


"Scott" wrote in message
...
I'm moving into new teretory by creating my most ambitious form yet.

Perhaps
it'll be a piece of cake for you experts

If you've used Quicken and the Online Payee list then you'll be familiar
with what I'm trying to do. In Quicken, if you enter a payment and

indicate
"Send" and then enter the Payee name, if the Payee doesn't yet exist then

a
form opens up where you can enter the Payee name, address, account and
telephone number.

I want to do the same thing in my new Access form. On the parent form I

want
to do a lookup on the customer id field [CUID]. If the customer hasn't

been
entered in the Customer Master table yet then I'd like the option to open

a
child form to create a new customer record.

Any suggestion on how I can do this or where I can read more about forms
like this?

Scott




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:57 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.