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

How to add two fields to a single combobox and how to modify the close form button

P: 18
Guys, I have two questions.

(a) How do I add two fields of the same table to a single combo box. For example if I have two fields ID1 and ID2 in a table called Identification, than how should I design a combobox in a form such that when I scroll down I get to see both the ID's.

(b) I have a (Close Form) button on a form. Let's say I am adding a new record from a form and I am half way filling up everything and suddenly if I change my mind not to save the record than I have a button to close it, but the problem is if I hit the close form button it still saves the record. How do I make the button into where it will just close but not save the record.

Any help appreciated.
Apr 2 '08 #1
Share this Question
Share on Google+
2 Replies


missinglinq
Expert 2.5K+
P: 3,532
Question A

  1. Place combobox on form
  2. Select I want combobox to look up values in a table or query.
  3. Follow prompts
  4. Select Identification table
  5. Select fields ID1 and ID2
  6. Follow prompts to finish combobox
Question B

Place button on form, naming it DumpNewRecordAndCloseButton
Place this code behind it:

Expand|Select|Wrap|Line Numbers
  1. Private Sub DumpNewRecordAndCloseButton_Click()
  2.  If Me.NewRecord Then
  3.    Me.Undo
  4.    DoCmd.Close acForm, Me.Name
  5.  End If
  6.  End Sub
Welcome to bytes!

Linq ;0)>
Apr 2 '08 #2

NeoPa
Expert Mod 15k+
P: 31,661
Please keep separate questions in their own threads in future.

This makes it easier to manage and to find later.

Admin.
Apr 3 '08 #3

Post your reply

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