?
Solved

Using a form to update data

Posted on 2011-02-27
6
Medium Priority
?
402 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 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
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

850 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