Solved

Using a form to update data

Posted on 2011-02-27
6
392 Views
Last Modified: 2013-11-28
Hi, I'm fairly new to VBA and SQL and i have what i believe is a simple problem for those in the know.

I have a main form with a command button to update dates. When i press this command button, a form opens up with 4 fields that will when updated on the form, a table will
be updated. Here are my questions.

1. I want the the form with the text boxes to be only as big as the 4 text boxes, ie,
it can't be expanded resulting in scroll bars on the RHS.

2. Is it possible to update teh dates and immediately below the text boxes have the options, "yes", 'no", "cancel'?
For now, i update the dates and I have to click the close button in the RHS corner of the form.

3. How do i make my cursor move from text box one to text box 2 etc once the dates have been updated?

Any form of help will be greatly appreciated.

Thanks!
0
Comment
Question by:DB_newbie_NZ
6 Comments
 
LVL 19

Expert Comment

by:Eric Sherman
ID: 34994440
<<<<<1. I want the the form with the text boxes to be only as big as the 4 text boxes, ie, it can't be expanded resulting in scroll bars on the RHS.>>>>>

You can change the size of your form and other form options to accomplish this.

<<<<<2. Is it possible to update teh dates and immediately below the text boxes have the options, "yes", 'no", "cancel'?
For now, i update the dates and I have to click the close button in the RHS corner of the form.>>>>>

Use Unbound controls on your form then update the table when needed.  Wouldn't No & Cancel do the same thing???


<<<<<3. How do i make my cursor move from text box one to text box 2 etc once the dates have been updated?>>>>>

Use the AfterUpdate Event of your field to SetFocus to another field on the form.


Hope this helps ....

ET


0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 34996309
In addition to ET's comments:

1. Also, regarding the fixed form size, set the BorderStyle of your form to Thin or Dialog. This prevents the user from resizing it.

2. Access bound controls behave this way. If you want more control, do as ET suggets and use unbound forms. However, often you can use the Form's BeforeUpdate event to insure that the user wishes to save:

Sub Form_BeforeUpdate(Cancel As Integer)
  If Msgbox("Do you want to save", vbYesNo, "Confirm") = vbNo Then
    Cancel = True
   End If
End Sub

You can also do this in the Control's BeforeUpdate event, but it will NOT stop you from saving the entire record. It would simply undo changes made in that control.

3. You might also try setting the TabOrder of the controls in your form will often provide you all the navigation needed. The TabOrder defines the order in which the controls receive focus. This is configured in the Design view of the form.

0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 34998804
DB_newbie_NZ,

I see that you are a new member, so first I will say :
"Welcome to EE!
;-)


Note that you have three separate questions here.
The format of this forum is Q&A.

Although your questions are basic, a great many times there is confusion over what post actually is the "Answer"
See here:
http://www.experts-exchange.com/help.jsp#hs=23&hi=23

;-)

JeffCoachman
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:DB_newbie_NZ
ID: 35002970
Hi, thank you... I have figured it out - all i needed to do was to make a dialog box and i managed to add combo boxes.

My only problem now is that the update queries to update the table with data entered in the form dialog box are not working...it's doing my head in.
0
 
LVL 3

Expert Comment

by:DockieBoy
ID: 35004632
I would probably close this question off one way or the other and start a new one with your new problem, best thing to do is give as much info as you can on the actual problem with your update query and if possible, upload the db.  :)
0
 

Author Closing Comment

by:DB_newbie_NZ
ID: 35004805
Thanks everyone for your help.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now