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

x
?
Solved

Access Hide fields in form until pressing submit

Posted on 2008-06-25
15
Medium Priority
?
227 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
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 
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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

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