Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 229
  • Last Modified:

Access Hide fields in form until pressing submit

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
Heather_D
Asked:
Heather_D
  • 9
  • 6
1 Solution
 
wiswalldCommented:
You could set the visible property to false and in your code for calculate put

Me.Field1.Visible = True
0
 
wiswalldCommented:
Sounds more like you may want to fix the math problem though
0
 
Heather_DAuthor Commented:
Me.Field1.Visible = True

Where exactly do I put this?

The math is working fine but thanks :)

0
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!

 
wiswalldCommented:
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
 
Heather_DAuthor Commented:
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
 
Heather_DAuthor Commented:
Excellent!! I got it to work with your suggestion.  I had to put it in my subform.

Thanks a bunch,

Heather
0
 
Heather_DAuthor Commented:
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
 
Heather_DAuthor Commented:
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
 
wiswalldCommented:
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
 
wiswalldCommented:
But give the requery a try first if that will work.
0
 
Heather_DAuthor Commented:
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
 
Heather_DAuthor Commented:
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
 
Heather_DAuthor Commented:
Also the left field is in an append table so there never is a null blank record.

0
 
wiswalldCommented:
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
 
Heather_DAuthor Commented:
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 9
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now