By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,139 Members | 1,228 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,139 IT Pros & Developers. It's quick & easy.

Linking tables

P: 25

Please can someone help me?!! For some reason I cant get my two data input forms to link on a ID value. I'm sure I have done this before, but for some reason I can get it to work and im ready to pull my hair out!!!

--Customer table
Contact Address etc

--Properties table
Address etc

I have two tables, Customers and Properties (one to many, linked via AccID), I then have a form for each. I want the user to input customer details then (via a button) go to the property form to add a property for that customer. I dont want the user to see the AccID field in the properties form (I want it to be linked to AccID on the customers form and automatically populated).

Any help would be FANTASTIC!!
Many Thanks
Feb 5 '09 #1
Share this Question
Share on Google+
3 Replies

Expert 100+
P: 1,287
DoCmd.OpenForm "Properties Form Name", , , , acFormAdd
Forms("Properties Form Name")![AccID] = AccID

You can have AccID locked/hidden on the properties form, one you see that it is getting the correct value.
Feb 5 '09 #2

P: 25
Thank you I have it working now.

also wonder if you can help me with this.
When I open a create customer account form, I want the main menu form to close, same as when I close/cancel the new customer account form I want it to close then open the main menu. (as well as ask the user if they are sure?)

This seems really simple stuff but i cant get it working !!!!!! aaarrgghhh!! ive taken code from a prev db i've done (which works and it doesnt work the same on my current one!!! im sure its something daft im not getting!
Feb 8 '09 #3

Expert 100+
P: 1,287
It sounds like you could set your new form to modal rather than close and then open your other form. That prevents users from doing anything to other forms while this one is open. It's on the Form Properties -> Other tab.

You can put this code in your button and disable/hide the control box and close button of the form.
Expand|Select|Wrap|Line Numbers
  1. Dim iResponse as Integer
  2. iResponse = MsgBox("Are you sure that you want to do this?", _
  3.     vbYesNo, "Confirmation")
  4. If iResponse = vbNo Then
  5.     Exit Sub
  6. End If
Feb 9 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.