469,331 Members | 1,785 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,331 developers. It's quick & easy.

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

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
2 1876
missinglinq
3,532 Expert 2GB
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
32,182 Expert Mod 16PB
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.

Similar topics

reply views Thread by Doug | last post: by
5 posts views Thread by ross kerr | last post: by
30 posts views Thread by dbuchanan | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Purva khokhar | last post: by
1 post views Thread by haryvincent176 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.