Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Using a form to update data

Posted on 2011-02-27
6
Medium Priority
?
400 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 1500 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
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…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

609 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