Dont know why this wont work?

That's really interesting and makes sense.

Incidentally, I have now created new forms as I said earlier which do reference the report number perfectly so barring any testing errors I think that problem will be solved?
 
As a matter of comment on your user interface, I think you would be better to load your main menu with a method of displaying a user filtered list box of reports to work on, they can then choose one and based on that choice you could then unlock the appropriate command buttons all on the one form.
The current combo dropdown will quickly become very awkward to scroll down and use if you have more than 10-15 reports to choose from.
 
Good morning Minty,

I'll try and work out how to make that work?

There should normally only be 1 report from the previous inspection on there but I just wanted to create the option in case there was another one loaded in the system.

Basically a technician would usually take the empty DB and enter the report during an inspection.

Once the report is complete the report is either left on the clients system at the site of the report or sent to the client as a pdf
 
Cant believe this!

I got it working perfectly after thinking about what you said!

I used this code in 'SelectReportFrm' :-

Code:
Private Sub ReportNumber_Change()

Me.ReportNumber.SetFocus
Forms!Main!ReportNo.SetFocus
Forms!Main!ReportNo.Text = Me.ReportNumber.Text

    If Mid([ReportNumber], 8, 3) = "TRA" Then
    Forms!Main!TOSubSection_Label.Visible = True
    Forms!Main!TOSubSection.Visible = True
    Forms!Main!ViewDROPSSubSectionBtn.Visible = False
    Forms!Main!ViewBySubSectionBtn.Visible = True
    Forms!Main!DROPSSubSection_Label.Visible = False
    Forms!Main!DROPSSubSection.Visible = False
    Else
    Forms!Main!DROPSSubSection_Label.Visible = True
    Forms!Main!DROPSSubSection.Visible = True
    Forms!Main!ViewBySubSectionBtn.Visible = False
    Forms!Main!ViewDROPSSubSectionBtn.Visible = True
    Forms!Main!TOSubSection_Label.Visible = False
    Forms!Main!TOSubSection.Visible = False
    End If

End Sub
 
I'm glad you got it working , but you haven't amended your set focus code to refer to the value to keep it cleaner. You can replace the 3 lines with one at the start;

Forms!Main!ReportNo = Me.ReportNumber.Text

I would strongly suggest you get used to working with the field values, and NOT the text displayed in the field, as sooner or later you will trip yourself up.
 
I will take that on board thanks for the great advice Minty.

I hope I manage to complete this with not too many more problems?

I'm slowly learning but entirely self taught and without the invaluable help from this site I would be completely stuck!

Thank you
 
On the SetFocus thing, I was trying to respond to error messages saying that I couldn't reference the object unless it had the focus - that's all. So maybe I was chasing a problem?

Normally, this isn't required. The object in question needs to be visible (if it is a control) and instantiated (if it is an application object), but it is rare to actually require something to be "in focus" to update it. (Not saying it never happens, but it is rare.)

When you do two .SetFocus in a row, there are at least four events that get triggered. Say, for the sake of argument, that you have three controls: A, B, and C. Further, let's say that you are currently in-focus on A but then execute these two commands:

Code:
B.SetFocus
C.SetFocus

What you will see is FOUR events, in approximately this order: A.LostFocus, B.GotFocus, B.LostFocus, C.GotFocus

If ANY of those control event routines has an explicit focus-change in it, you will hose up your focus control operations. There are other things that you can't do if you have focus (like hide or disable a control) that might prevent completion of the focus routines you were trying to manage.
 
Hi Doc Man,

Thank you so much for taking the time to explain which is great!

As I say, I am learning slowly but I am entirely self taught! :)
 

Users who are viewing this thread

Back
Top Bottom