form vba assistance on if statement

It's not the direction I'd go, but 6 forms (presumably in 6 different front ends) shouldn't be a problem. I wouldn't want to maintain 6 forms, so I'd be more likely to put in a simple login form and filter based on it.
 
I agree this would be easier but with the split form and prior issues and what not I thought it would be simple to just add the filter and copy the form 6x. I also thought about using the netlogin name but given the length of time just wasnt sure how easy it would be.

I would be interested to see if you have a sample or can point me in the right direction towards a switchboard startup with logic that will open a filtered form based on user name/password.
 
Ok I had a heck of a time trying to get all the box names and label names to disappear so I went ahead and did tabs for one area and just referenced the tab name vs trying to note every little field.

My next question would be.

I have a field when it is equal to xx or xx or xx I want to make a field visible. This field is a comments field that is required. I know how to do the .visible portion however in addition to my previous request is there something put into the if statement that right after the comment field becomes viewable that you cannot lose focus unless it is a dirty field or info has been typed?
 
I just found the API get Login Name. But I thought I read someplace else that in order to use the filter that way on the form from the user name that the form itself should be driven by a query. Did I setup my initial form incorrectly by linking it to the table itself?

I saw these as well

http://www.databasedev.co.uk/filter_current_user.html
http://www.databasedev.co.uk/login.html

However probably out of my league to edit to get to work correctly

Also to require a field it would be me.yourfieldname.?? I tried required but that doesnt work. Still searching in google.
Or would it be a simple

if me.triggerfield =Y and me.comment field is null then
msgbox?
 
Something tells me the answer to this is no but I figured I would inquire either way.

Is it possible to filter a form by a field in the form. Not a drop down combo box filtering the form but rather I have a field setup that pulls in

Private Sub Form_Open(Cancel As Integer)
'Populate the LoginName textbox with the CurrentUserName
Me.LoginName = GetCurrentUserName()
End Sub

I then put this in the form filter area. While the form loads/opens fine it is empty so I am thinking it is pulling a null value as the login name isnt populated? Short of creating a hidden form to store the login name value is there another way to accomplish this?
((((tblMain.Resource)=[Forms]![WindOptOutV12]![LoginName])))
 
I'd probably have the hidden form to avoid repeated calls to the function, but this should work:

tblMain.Resource=GetCurrentUserName()
 
I did filter on open and it appears to work.

For this you will need to alter the filter so it will show records however I keep having issues with all my visible/if statements where it tells me cannot hide item on focus.

It is hard to duplicate but if i click through and have data in the Individual or entity fields and click to the next one in the subform I start to run into issues.

I wonder if this is a case of if statements overlapping with the visible feature?

I am curious to have you take a look to see if there should be improvements to what I am trying to accomplish or a better way
 

Attachments

Users who are viewing this thread

Back
Top Bottom