How to open a second form based on info from first form?
Could someone please help me with the IF-syntax below?
This is what we need to do:
- Add a new record on
Form1
; - Click a button on
Form1
to openForm2
; - When
Form2
opens, it contains info from开发者_StackOverflow中文版Form1
.
So, I add this to Properties/OnDirty/CodeBuilder
:
If me.Dirty = True then
Me.Dirty = false
Docmd.OpenForm "Form2",,,"EvalID = " & me!Eval_ID
As soon as I enter data, the Docmd
line creates a
run-time error 3075, syntax error (missing operator)...EvalID
In Form1
the key is Eval_ID
and in Form2
I have EvalID
(but not not the key).
Any suggestions?
It looks to me like there are a few things going on here. It would also help to confirm some information:
- Is this referring to a MS Access form or some other VBA-driven form?
- Are both forms bound to tables or editable queries?
This isn't likely the issue causing the syntax error. It should be simple enough to resolve that. Put a breakpoint in the code at that location. At that point, copy the resulting string (e.g. EvalID = 7) after the word "WHERE" in the SQL view of a new query based on the two tables. Preview the query to debug the cause of the problem with that expression.
精彩评论