Solved

Using a form to update data

Posted on 2011-02-27
6
395 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many companies are making the switch from Microsoft to Google Apps (https://www.google.com/work/apps/business/). Use this article to learn more about what Google Apps has to offer and to help if you’re planning on migrating to Google Apps. It is …
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

828 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