Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

don't get selected combobox value from form

Status
Not open for further replies.

franktm

IS-IT--Management
Aug 16, 2005
3
BE
It may be a stupid question, I am no advance programmer, but could not find info on this.
I have a form with a combobox bound with a table. In a module I run code to work on a recordset. That runs fine. But in some cases it needs the user to select an entry from a list. For that I open this form. I checked that the combobox is nicely filled with all values. But running it from the module I do not even get to see it. I get runtime error '94' - Invalid use of Null.
I understand this is because nothing is selected yet in the combobox, but I had no change yet as the process continues with the next line. The relevant part of the code is:

Code:
strT = ""
Form_frmAskInput.Visible = True
strT = Form_frmAskInput!cboTypes.Value
Form_frmAskInput.Visible = False

Do I need to build in a waiting loop? There must be smarter way to do this.

I tried to reference differently to the form, e.g. with frmAskInput, but all failed but the above one. Is this playing a role? I have no other references to forms.
 
How are you opening frmAskInput? You need to set the WindowMode to acDialog to make it wait for input, if you are opening it in the middle of some code.
 
[sorry to be rude in my first message, please note that I am thankful for any advise in the good direction, Frank]

Remou,
I tried to open with DoCmd.OpenForm frmAskinput,,,,,acDialog, but I get Runtime error 2494 - 'The action or method requires a Form Name argument'.
The form exists in the database.

thx Frank
 
I should have said, welcome to Tek-Tips. :)

The form name argument is a string:

[tt]DoCmd.OpenForm "frmAskinput",,,,,acDialog[/tt]

Or
[tt]strForm="frmAskinput"
DoCmd.OpenForm strForm,,,,,acDialog[/tt]
 
Thanks Remou,
that works now! Feel a bit dummy about the quotes.

thx Frank
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top