?
Solved

Access Hide fields in form until pressing submit

Posted on 2008-06-25
15
Medium Priority
?
224 Views
Last Modified: 2010-04-21
Greetings,

I have a 2 forms, one form and a subform, that calculates time equations on the fly.  I needed the values to allow for null values that works also.  Problem is that when the calculation have not completed, it shows erroneous numbers.  For example, the total amount show 30 (correct number) but the time left may show 3 (not correct because it hasn't been calculated.)

Is there a way that will allow me to hide the fields until the calculation has been completed by either pressing submit or on enter?

Thanks,

Heather
0
Comment
Question by:Heather_D
[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
  • 9
  • 6
15 Comments
 
LVL 13

Accepted Solution

by:
wiswalld earned 2000 total points
ID: 21869811
You could set the visible property to false and in your code for calculate put

Me.Field1.Visible = True
0
 
LVL 13

Expert Comment

by:wiswalld
ID: 21869820
Sounds more like you may want to fix the math problem though
0
 

Author Comment

by:Heather_D
ID: 21869839
Me.Field1.Visible = True

Where exactly do I put this?

The math is working fine but thanks :)

0
Independent Software Vendors: 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!

 
LVL 13

Expert Comment

by:wiswalld
ID: 21870163
First right click the field and set the visible property for the field to false. Then in the button you said you had to perform calculations or however you do this put this after your math calculations.
0
 

Author Comment

by:Heather_D
ID: 21870964
Thanks but the math calculations are equations in a query.  The calculations are totaled and then the submit button takes the calculations and puts them in a table.  

Can I put the equation above in the submit but I would think that the calculations in the subform would still show.

I appreciate the help,

heather
0
 

Author Closing Comment

by:Heather_D
ID: 31470758
Excellent!! I got it to work with your suggestion.  I had to put it in my subform.

Thanks a bunch,

Heather
0
 

Author Comment

by:Heather_D
ID: 21871386
Seems like once I exit out of the database and open it again, the properties for visible turns back to YES.  Is there a way to make the visible permanently no?
0
 

Author Comment

by:Heather_D
ID: 21871465
One other question, It works fine but when I go to the next record, the fields are visible on the form. If I close the form and reopen, then it works again.

Do I need to add something like me.requery or me.refresh.

I tired both and nothing is working.

Heather
0
 
LVL 13

Expert Comment

by:wiswalld
ID: 21873917
I don't see how a requery would help that. Are you using the access built in navigator at the bottom of the form or your own custom buttons? That was why I reccomended maybe a math problem. You could have set the field to something like

If Me.Field1 = "" Then
Me.Field1.Visible = False
Else
Me.Field1.Visible = True
End If

That way if your math calculation had yet to be done the field would be invisible. You probably could still do this though with your existing math. Does the field always show the same value before the calculation? If so then

If Me.Field1 = "3" Then
Me.Field1.Visible = False
Else
Me.Field1.Visible = True
End If
0
 
LVL 13

Expert Comment

by:wiswalld
ID: 21873919
But give the requery a try first if that will work.
0
 

Author Comment

by:Heather_D
ID: 21875890
Requery is not working.  What is happening is 2 things:

1) the default visible switches from no to yes when the database is reopened
2) when the form is first open, all fields are hidden and works great when pressing the submit button.  The form then goes blank allowing for new fields to be inputted.  When that happens, the invisible fields are visible again.  If I switch from the designer back to view, the fields are invisible again.  That was why i was thinking a requery or refresh or something to make the form think that it's just being open or something.

As for the code:

If Me.Field1 = "" Then
Me.Field1.Visible = False
Else
Me.Field1.Visible = True
End If

I'll give this a try and see what happens.

Thanks!  I wish I could give you another 500 points for this one :)

Heather
0
 

Author Comment

by:Heather_D
ID: 21875972
Tried the
If Me.Field1 = "" Then
Me.Field1.Visible = False
Else
Me.Field1.Visible = True
End If

Didn't work.  I was thinking that the fields are not null but contains some erroneous number before the final calculation.  That is why that is not working.  Also, I did a test to remove the
Me.Field1.Visible = True
 and the fields remained hidden on for the next records on the form.

Is there a way to say if going to new ID, make the fields invisible again.  I am thinking that it is making it visible when a field is populated (which is correct) but not switching it back to invisible for the next record.

thanks,

heather
0
 

Author Comment

by:Heather_D
ID: 21876200
Also the left field is in an append table so there never is a null blank record.

0
 
LVL 13

Expert Comment

by:wiswalld
ID: 21876597
To do these calculations I am guessing you have at least two fileds and then the third field(the invisible one) to perform the calculations. If they are normally blank or would be blank when you go to a new record then what about this in the on current for the form:

If Me.Field1 = "" Then   'Field1 would be a normal field for the calculations
Me.Field2.Visible = True   'Field2 would be the field we want to make visible/invisible
Else
Me.Field2.Visible = False
End If





0
 

Author Comment

by:Heather_D
ID: 21876804
Okay, I got two fields on my main form to work by setting the Me.RoundTotal.visible = False after the submit button. That seemed to make the field invisible again for the next record.  However, I can't get the Left field which is in the subform to work that way. I have tried everything form exit, after update, etc and nothing is turning the visibility back to false. I can manually go into the properties and set the visibility to no and it will work on the form.

How can I control a subform field from the main form? I am thinking if I can make the left field go back to invisible at the submit on the main form, that might work.

Thanks,

heather
0

Featured Post

Command Line Tips and Tricks

The command line is a powerful tool at the disposal of every Linux user. Although Linux distros come with beautiful user interfaces, it's worthwhile to learn the command line because it allows you to do a number of things that you otherwise cannot do from the GUI.  

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.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

800 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