Adding delivery adddress

S

Simon

I have a order form which has the account number, i also have a combo
box that lets be choose which deliveyr address to send it to. If it a
new delliver address that i do not have on recored i want a button to
open a new recored in frmDeliveryAddress to i can type in a new
address.

I have done the button but im not sure how set the AccountNumber on
frmDeliveryAddress to be the same as the one on frmOrder.

Thanks

Simon
 
G

Guest

Hi Simon

If you have 2 tables - one for cleints (or whatever) and one for delevery
address 1st you need to ensure that you have the tables linked
You could use the field AccountNumber or clientID or whatever.

eg.
tblClients
AccountNumber
etc.

tblDeliveryAddress
DeliveryAddressID
AccountNumber - linked with tblClients
etc.
Change the names to what you normally use

Next ensure that there is a field called AccountNumber on both the main form
and the popup form (I assume you are uwanting a popupform for the delivery
address)

Assuming that you do have a field called AccountNumber on both the main form
and the popup form, you could use this

Private Sub ButtonName_Click()
On Error GoTo Err_ButtonName_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "PopUpFormName"
stLinkCriteria = "[AccountNumber]=" & Me![AccountNumber]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_ButtonName_Click:
Exit Sub
Err_ButtonName_Click:
MsgBox Err.Description
Resume Exit_ButtonName_Click
End Sub

Change the "ButtonName" in the above to what it is on your form

Hope this helps

--
Wayne
Manchester, England.
Enjoy whatever it is you do
Scusate,ma il mio Inglese fa schiffo :)
Percio se non ci siamo capiti, mi mandate un
messagio e provero di spiegarmi meglio.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top