Solved

Using a form to update data

Posted on 2011-02-27
6
393 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Lync meeting or Lync conferencing is what many organizations would like to deploy to allow them save money. But companies are now giving up for various reasons, one of which is that they cannot join external meetings (non-federated company meetings)…
The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

863 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

24 Experts available now in Live!

Get 1:1 Help Now