By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,475 Members | 2,037 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,475 IT Pros & Developers. It's quick & easy.

automatically fill controls from a new open form

P: n/a
hey... i have a form with a cmd button that opens a 2nd form with acdialog as
the windowmode. upon opening, if certain fields are filled, i would like to
pull those values into some of the controls of the new form. here's the code
i have in the open even of the 2nd form:

If CurrentProject.AllForms("form1").IsLoaded = True Then
If IsNull(Forms!form1.Controls!txtboxdate) = False Then
Me.txtboxdate = Forms![form1].[txtboxdate]
End If
If IsNull(Forms!form1.Controls!txtboxbuyersfirstname) = False Then
Me.txtboxname = Forms![form1].[txtboxbuyersfirstname] & " " &
Forms![form1].[txtboxbuyerslastname]
End If
Me.cboxact.SetFocus
Else
Me.txtboxdate.SetFocus
End If

unfortunately, i'm being told by access that i can't set a value to this
object and the debugger is opened with this highlighted:

Me.txtboxdate = Forms![form1].[txtboxdate]

any clues? thanks.

--
Greg

Message posted via http://www.accessmonster.com
Apr 24 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Look at the control of Me.txtboxdate. Do you have an expression something
like = Date() there? If you have any kind of expression there, you can not
programatically set its value.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
Over 1175 users have come to me from the newsgroups requesting help
re******@pcdatasheet.com
"ka******@comcast.net via AccessMonster.com" <u15580@uwe> wrote in message
news:5f4700c66b1b6@uwe...
hey... i have a form with a cmd button that opens a 2nd form with acdialog
as
the windowmode. upon opening, if certain fields are filled, i would like
to
pull those values into some of the controls of the new form. here's the
code
i have in the open even of the 2nd form:

If CurrentProject.AllForms("form1").IsLoaded = True Then
If IsNull(Forms!form1.Controls!txtboxdate) = False Then
Me.txtboxdate = Forms![form1].[txtboxdate]
End If
If IsNull(Forms!form1.Controls!txtboxbuyersfirstname) = False Then
Me.txtboxname = Forms![form1].[txtboxbuyersfirstname] & " " &
Forms![form1].[txtboxbuyerslastname]
End If
Me.cboxact.SetFocus
Else
Me.txtboxdate.SetFocus
End If

unfortunately, i'm being told by access that i can't set a value to this
object and the debugger is opened with this highlighted:

Me.txtboxdate = Forms![form1].[txtboxdate]

any clues? thanks.

--
Greg

Message posted via http://www.accessmonster.com

Apr 25 '06 #2

P: n/a
"ka******@comcast.net via AccessMonster.com" <u15580@uwe> wrote in message
news:5f4700c66b1b6@uwe...
hey... i have a form with a cmd button that opens a 2nd form with acdialog
as
the windowmode. upon opening, if certain fields are filled, i would like
to
pull those values into some of the controls of the new form. here's the
code
i have in the open even of the 2nd form:

If CurrentProject.AllForms("form1").IsLoaded = True Then
If IsNull(Forms!form1.Controls!txtboxdate) = False Then
Me.txtboxdate = Forms![form1].[txtboxdate]
End If
If IsNull(Forms!form1.Controls!txtboxbuyersfirstname) = False Then
Me.txtboxname = Forms![form1].[txtboxbuyersfirstname] & " " &
Forms![form1].[txtboxbuyerslastname]
End If
Me.cboxact.SetFocus
Else
Me.txtboxdate.SetFocus
End If

unfortunately, i'm being told by access that i can't set a value to this
object and the debugger is opened with this highlighted:

Me.txtboxdate = Forms![form1].[txtboxdate]


I would simplify the code along the lines of

If CurrentProject.AllForms("form1").IsLoaded = True Then
If Not IsNull(Forms!form1.Controls!txtboxdate) Then Me.txtboxdate =
Forms![form1].[txtboxdate]
If Not IsNull(Forms!form1.Controls!txtboxbuyersfirstname) Then
Me.txtboxname = Forms![form1].[txtboxbuyersfirstname] & " " &
Forms![form1].[txtboxbuyerslastname]
Me.cboxact.SetFocus
Else
Me.txtboxdate.SetFocus
End If

It probably won't fix your problem but, as you code grows, it will be a
little easier to debug.

Regards,
Keith.
www.keithwilby.com
Apr 25 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.