Dialogue Box and associated code...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a module that contains all the code, nothing on the forms. In one function, I issue an OpenForm to open a single-control form that prompts for a year to be entered and press OK to close the form
DoCmd.OpenForm ("frmEnterYear"
strYear = [Forms]![frmEnterYear]![txtYear
The form gets opened and for some reason, execution of code continues to the next line without waiting for the user to press OK
I know it's something stupid but I can't seem to figure it out. Any thoughts

TIA, LenP
 
DoCmd.OpenForm ("frmEnterYear")
strYear = [Forms]![frmEnterYear]![txtYear]
The form gets opened and for some reason, execution of code continues

That is the wonder of event-oriented programming!

You might want to look up help on the OpenForm method, and in particular
look up the vbModal parameter.

Hope that helps


Tim F
 
Thanks Tim
The form is set for Modal=Yes. What I ended up doing was

Do Until Isloaded("frmEnterYear") = Fals
DoEvent
Loo
 
No, No, No,

Len, please set the following properties:

Pop Up = Yes
Modal = Yes
Border Style = Dialog

Then open your form using the parameters:

DoCmd.OpenForm myFormName, acNormal, , myWhereClause, acFormEdit, acDialog
 
Thanks Solex, works slick as sh*t off a shovel

I had the form properties set properly for modal etc, however I wasn't using all the OpenForm parms

BTW, I'm assuming that the acNormal isn't necessary since it is the default

Cheers
Len
 
A collection is a generic list and contain anything you want. If you want
it to hold something other then a string you will have to build it. For
instance you could create a class with the following properties

Public Class: Person

Name As String
Sex As String * 1
FavoriteBeverage As String
etc...

Dim coll as New Collection

Dim x as New Person
x.Name = "Dan"
x.Sex = "M"
x.FavoriteBeverage = "Stella"

coll.Add(x)


LenP said:
Dan:

One question... is a collection like a recordset, in that you can have
more than one 'item/field', i.e. name, sex, fav bevvy or do they only
contain a collection of one item, ie, names
 
Thanks Dan
That makes it very clear. What I'm trying to do is build a table of files that are older than a specific date. I am able to build that table, however I can't seem to come up with a clear method of getting the file size for each file. I looked at the .size property, however it seems only to work with an object and I really have not specified any
Any thoughts
TIA
Len
 
Len, try this: FileLen(PathToYourFile)

LenP said:
Thanks Dan!
That makes it very clear. What I'm trying to do is build a table of files
that are older than a specific date. I am able to build that table, however
I can't seem to come up with a clear method of getting the file size for
each file. I looked at the .size property, however it seems only to work
with an object and I really have not specified any.
 
Back
Top