NewData var not passing during NotInList event

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

Guest

I'm trying to use the NotInList event on my 'cultures' form to open an
'addNumber' form, use 'addNumber' to add a number to the underlying lookup
table, then return to the main form. Here is my sticking point:

DoCmd.OpenForm addNumber, acNormal, , , acFormAdd, acDialog, NewData

This command opens the 'addNumber' form, and allows user to fill in the
desired number (and subsequent fields), but I can't seem to get the NewData
argument to pass to the form. I've tried all types of contortions with the
events associated with the 'addNumber' form to populate the txtNumber text
box with the NewData value. When I set a break point within the 'addNumber'
form I see that NewData = 0, but when I look in the 'cultures' code NewData
has the value typed in by the user.

When I remove acDialog from the .OpenForm command I can manipulate the text
box value and set it appropriately with the following:

DoCmd.OpenForm addNumber, acNormal, , , acFormAdd, acDialog, NewData
Forms!addNumber.txtNumber = NewData

Of course, then I have problems getting the combo box to requery when the
'addNumber' form closes.

Any ideas?
 
Michael Mac said:
I'm trying to use the NotInList event on my 'cultures' form to open an
'addNumber' form, use 'addNumber' to add a number to the underlying lookup
table, then return to the main form. Here is my sticking point:

DoCmd.OpenForm addNumber, acNormal, , , acFormAdd, acDialog, NewData

This command opens the 'addNumber' form, and allows user to fill in the
desired number (and subsequent fields), but I can't seem to get the NewData
argument to pass to the form. I've tried all types of contortions with the
events associated with the 'addNumber' form to populate the txtNumber text
box with the NewData value. When I set a break point within the 'addNumber'
form I see that NewData = 0, but when I look in the 'cultures' code NewData
has the value typed in by the user.

When I remove acDialog from the .OpenForm command I can manipulate the text
box value and set it appropriately with the following:

DoCmd.OpenForm addNumber, acNormal, , , acFormAdd, acDialog, NewData
Forms!addNumber.txtNumber = NewData

Of course, then I have problems getting the combo box to requery when the
'addNumber' form closes.

Any ideas?

Paste this in the FORM 'addNumber' OnOpen event:

Private Sub Form_Open(Cancel As Integer)
Me.txtNumber = Forms!addnumber.OpenArgs
End Sub
 
SteveS said:
Paste this in the FORM 'addNumber' OnOpen event:

Private Sub Form_Open(Cancel As Integer)
Me.txtNumber = Forms!addnumber.OpenArgs
End Sub

Thanks, Steve S

I gave the above a whack, no luck...then I put it in the load event for the
form and changed the period to an exclamation point & success. I wouldn't
have gotten there without your help.

Private Sub Form_Load()
Me!txtNumber = Forms!addnumber.OpenArgs
End Sub

Wooo Hooo (I'm easily amused)!!
Michael Mac
 
Wooo Hooo (I'm easily amused)!!
Michael Mac



;-D

Sorry about the dot/bang... the company just converted to Off 2003 :-(
and strange ting r happenin #$^&^$% ... <g>... don't like it one bit (or
byte)!
 
Back
Top