Can't assign var values to fields on current form

G

Guest

Hello ALL:

I open a form2 from a form1 and pass a few variable values over to it, which values are present, but it says that it can't assign them.

In my development .mdb copy, it works fine.
When copied it to Test and updated my links to my Test back end .mdb, it stopped working.

Halp! Why does re-linking do this?

The code is:
Private Sub Form_BeforeInsert(Cancel As Integer)
'DoEvents
'assign necessary key values to the Cycle table
'note: referring back to frmProjectIssue was intermittent
MsgBox Me.Name 'The msgbox is to show me that I am in the current form,
form2, and I am.

Me!ParentProjectID = gvarInterParentProjectID
Me!ProjectID = gvarInterProjectID
Me!Item = gvarInterItem

End Sub

The vars are declared as Public Variants, in a Module, and and the 3 values are Numbers.
 
A

Allen Browne

Check that you are able to manually enter records into this form, i.e. its
RecordSource is not read only.

In your code window, create a breakpoint by pressing F9 in the line:
Me!ParentProejctID = ...
Then run the code. When it stops at this point, use the Immediate Window
(Ctrl+G) to examine the variables, e.g.:
? TypeName(gvarInterParentProjectID)

You are probably aware that variables lose their value when you reset your
code?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Michael Miller said:
Hello ALL:

I open a form2 from a form1 and pass a few variable values over to it,
which values are present, but it says that it can't assign them.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top