Help needed with simple field problem (0/1)

D

Doug

Well, if you changed the code to add records from a command button, per the
instructions I sent, then that would explain why it's not working from the
form's AfterUpdate or AfterInsert event: the form is not inserting the
record; you are, though the code. So the AfterUpdate and AfterInsert events
wouldn't apply.

Just put the combo box requery code at the end of the routine that adds the
new record, and you should be fine.

I tried that, but I don't know how to reference it, and haven't gotten
around to searching Google for that. "Me" is not pointing to the form
in the add record routine. (There is no "Combo36" in the list after
you type "Me." - like there is in the AfterUpdate routine.) I need to
get a basic book on using Access (just systax, I know how to program -
I've also never used VB before). It took me about 30 minutes
searching Google to find how to change a fields value... (you use the
"clone"...) Do you know of a good/short online reference?

Well, it should work. What's the rowsource of your combo box? Please copy
and paste it here exactly.

Row Source Type: Table/Query
Row Source: SELECT [Clients].[ClientID], [Clients].[FirstName],
[Clients].[MiddleName], [Clients].[LastName] FROM Clients;

I am adding records from a control button on the form now.

I tested this again, and now the combo box is updated with
Combo36_gotFocus(). I'd prefer to only update that when necessary,
not every time a new record is selected... I don't know why that
works now. The combo box is still not updated with either
Form_AfterInsert() or Form_AfterUpdate().
(SNIP)

Once I use the combo box to select a record, the record selector count
changes to 1. I can still arrow over to 2 and enter a new record.
When I do that the new record doesn't show up in the combo box list
(the others still do). If I close the form and reopen it, the combo
box sees the new record(s).

Well, as John noted, just requery the combo box when a new record is
inserted (I'd do the After Insert event of the form). Just do:

Me.MyComboBox.Requery


I've put that in three places (below). The only thing that updates the
combo box is closing the form and reopening it.

Private Sub Combo36_GotFocus()
Me.Combo36.Requery
End Sub

Private Sub Form_AfterInsert()
Me.Combo36.Requery
End Sub

Private Sub Form_AfterUpdate()
Me.Combo36.Requery
End Sub


(SNIP)

The above is for if you prompt the user for the PK (customer ID?). If
the
PK
is an autonumber PK, then you'd do this instead:

=========================================
Dim rs As Recordset

Set rs = CurrentDb.OpenRecordset("MyTable, dbopenDynaset)

rs.AddNew
rs!OtherField = someothervalue 'This is optional.
rs.Update

rs.bookmark = rs.LastModified
Me.Recordsource = "Select * From MyTable Where FieldPK="& rs!FieldPK

rs.close
set rs = nothing
=========================================

That worked. Thanks.


4) While in a code module, go to Tools | References. Uncheck Microsoft
ActiveX Data Objects (if it's checked). If "Microsoft DAO" is not
checked,
then scroll down the list, and check the highest numbered version of it.

And that should do it.

Neil


(SNIP)
 
N

Neil

OK, we need to back up a second here. You said that the routine I sent to
add a record was working. That routine referenced Me in the Me.Recordsource=
item. But you write: "'Me' is not pointing to the form in the add record
routine." So, if "Me" is not pointing to the form in the add record routine,
then how does the Me.Recordsource= line in the add record routine work? If
Me works in one line of the routine, it will work in the other line of the
same routine.

So, I assume that the add record routine is in your button's OnClick event,
and it resides in the form's code module, correct? If so, then Me will work.
If you're not seeing Combo36, then it's either not in the form's code
module, or there's a compile error and that has to be resolved first. Try
compiling and see what happens.


Well, if you changed the code to add records from a command button, per
the
instructions I sent, then that would explain why it's not working from the
form's AfterUpdate or AfterInsert event: the form is not inserting the
record; you are, though the code. So the AfterUpdate and AfterInsert
events
wouldn't apply.

Just put the combo box requery code at the end of the routine that adds
the
new record, and you should be fine.

I tried that, but I don't know how to reference it, and haven't gotten
around to searching Google for that. "Me" is not pointing to the form
in the add record routine. (There is no "Combo36" in the list after
you type "Me." - like there is in the AfterUpdate routine.) I need to
get a basic book on using Access (just systax, I know how to program -
I've also never used VB before). It took me about 30 minutes
searching Google to find how to change a fields value... (you use the
"clone"...) Do you know of a good/short online reference?

Well, it should work. What's the rowsource of your combo box? Please
copy
and paste it here exactly.

Row Source Type: Table/Query
Row Source: SELECT [Clients].[ClientID], [Clients].[FirstName],
[Clients].[MiddleName], [Clients].[LastName] FROM Clients;

I am adding records from a control button on the form now.

I tested this again, and now the combo box is updated with
Combo36_gotFocus(). I'd prefer to only update that when necessary,
not every time a new record is selected... I don't know why that
works now. The combo box is still not updated with either
Form_AfterInsert() or Form_AfterUpdate().




(SNIP)

Once I use the combo box to select a record, the record selector
count
changes to 1. I can still arrow over to 2 and enter a new record.
When I do that the new record doesn't show up in the combo box list
(the others still do). If I close the form and reopen it, the combo
box sees the new record(s).

Well, as John noted, just requery the combo box when a new record is
inserted (I'd do the After Insert event of the form). Just do:

Me.MyComboBox.Requery


I've put that in three places (below). The only thing that updates the
combo box is closing the form and reopening it.

Private Sub Combo36_GotFocus()
Me.Combo36.Requery
End Sub

Private Sub Form_AfterInsert()
Me.Combo36.Requery
End Sub

Private Sub Form_AfterUpdate()
Me.Combo36.Requery
End Sub


(SNIP)

The above is for if you prompt the user for the PK (customer ID?). If
the
PK
is an autonumber PK, then you'd do this instead:

=========================================
Dim rs As Recordset

Set rs = CurrentDb.OpenRecordset("MyTable, dbopenDynaset)

rs.AddNew
rs!OtherField = someothervalue 'This is optional.
rs.Update

rs.bookmark = rs.LastModified
Me.Recordsource = "Select * From MyTable Where FieldPK="& rs!FieldPK

rs.close
set rs = nothing
=========================================

That worked. Thanks.


4) While in a code module, go to Tools | References. Uncheck Microsoft
ActiveX Data Objects (if it's checked). If "Microsoft DAO" is not
checked,
then scroll down the list, and check the highest numbered version of
it.

And that should do it.

Neil


(SNIP)
 
J

John W. Vinson

No, I'm not familiar with an online reference, though someone else here
might be. I would just go to my local Barnes and Noble or Borders and pick
up a beginning or intermediate Access programming book.

Here are my (incomplete) list of useful online references...

Jeff Conrad's resources page:
http://www.accessmvp.com/JConrad/accessjunkie/resources.html

The Access Web resources page:
http://www.mvps.org/access/resources/index.html

A free tutorial written by Crystal (MS Access MVP):
http://allenbrowne.com/casu-22.html

MVP Allen Browne's tutorials:
http://allenbrowne.com/links.html#Tutorials

John W. Vinson [MVP]
 
N

Neil

Thanks for providing that. I'm sure the OP will find that very useful. I'm
going to save it for future reference, myself.
 
D

Doug

Your right. I must have made a typo. There's a new problem. The new
record is not sorted in the combo box, it's at the top of the list.
When Me.Combo36.Requery is in the Combo36_GotFocus() routine, the list
is resorted. I did a couple tests, and this behavior is consistent.
(I put the requery just before exit sub in the add record routine.)


OK, we need to back up a second here. You said that the routine I sent to
add a record was working. That routine referenced Me in the Me.Recordsource=
item. But you write: "'Me' is not pointing to the form in the add record
routine." So, if "Me" is not pointing to the form in the add record routine,
then how does the Me.Recordsource= line in the add record routine work? If
Me works in one line of the routine, it will work in the other line of the
same routine.

So, I assume that the add record routine is in your button's OnClick event,
and it resides in the form's code module, correct? If so, then Me will work.
If you're not seeing Combo36, then it's either not in the form's code
module, or there's a compile error and that has to be resolved first. Try
compiling and see what happens.


Well, if you changed the code to add records from a command button, per
the
instructions I sent, then that would explain why it's not working from the
form's AfterUpdate or AfterInsert event: the form is not inserting the
record; you are, though the code. So the AfterUpdate and AfterInsert
events
wouldn't apply.

Just put the combo box requery code at the end of the routine that adds
the
new record, and you should be fine.

I tried that, but I don't know how to reference it, and haven't gotten
around to searching Google for that. "Me" is not pointing to the form
in the add record routine. (There is no "Combo36" in the list after
you type "Me." - like there is in the AfterUpdate routine.) I need to
get a basic book on using Access (just systax, I know how to program -
I've also never used VB before). It took me about 30 minutes
searching Google to find how to change a fields value... (you use the
"clone"...) Do you know of a good/short online reference?

Well, it should work. What's the rowsource of your combo box? Please
copy
and paste it here exactly.

Row Source Type: Table/Query
Row Source: SELECT [Clients].[ClientID], [Clients].[FirstName],
[Clients].[MiddleName], [Clients].[LastName] FROM Clients;

I am adding records from a control button on the form now.

I tested this again, and now the combo box is updated with
Combo36_gotFocus(). I'd prefer to only update that when necessary,
not every time a new record is selected... I don't know why that
works now. The combo box is still not updated with either
Form_AfterInsert() or Form_AfterUpdate().




(SNIP)

Once I use the combo box to select a record, the record selector
count
changes to 1. I can still arrow over to 2 and enter a new record.
When I do that the new record doesn't show up in the combo box list
(the others still do). If I close the form and reopen it, the combo
box sees the new record(s).

Well, as John noted, just requery the combo box when a new record is
inserted (I'd do the After Insert event of the form). Just do:

Me.MyComboBox.Requery


I've put that in three places (below). The only thing that updates the
combo box is closing the form and reopening it.

Private Sub Combo36_GotFocus()
Me.Combo36.Requery
End Sub

Private Sub Form_AfterInsert()
Me.Combo36.Requery
End Sub

Private Sub Form_AfterUpdate()
Me.Combo36.Requery
End Sub


(SNIP)

The above is for if you prompt the user for the PK (customer ID?). If
the
PK
is an autonumber PK, then you'd do this instead:

=========================================
Dim rs As Recordset

Set rs = CurrentDb.OpenRecordset("MyTable, dbopenDynaset)

rs.AddNew
rs!OtherField = someothervalue 'This is optional.
rs.Update

rs.bookmark = rs.LastModified
Me.Recordsource = "Select * From MyTable Where FieldPK="& rs!FieldPK

rs.close
set rs = nothing
=========================================

That worked. Thanks.


4) While in a code module, go to Tools | References. Uncheck Microsoft
ActiveX Data Objects (if it's checked). If "Microsoft DAO" is not
checked,
then scroll down the list, and check the highest numbered version of
it.

And that should do it.

Neil


(SNIP)
 
N

Neil

Where you place the requery command should have no effect on the sorting of
the combo box. Is you combo explicitly sorted? If so, then this shouldn't be
happening. If not, then there might be some weird glitch with a new record
being at the top, etc. Either way, just make sure you have an explicit sort
in your combo's rowsource, and you should fine.


Your right. I must have made a typo. There's a new problem. The new
record is not sorted in the combo box, it's at the top of the list.
When Me.Combo36.Requery is in the Combo36_GotFocus() routine, the list
is resorted. I did a couple tests, and this behavior is consistent.
(I put the requery just before exit sub in the add record routine.)


OK, we need to back up a second here. You said that the routine I sent to
add a record was working. That routine referenced Me in the
Me.Recordsource=
item. But you write: "'Me' is not pointing to the form in the add record
routine." So, if "Me" is not pointing to the form in the add record
routine,
then how does the Me.Recordsource= line in the add record routine work? If
Me works in one line of the routine, it will work in the other line of the
same routine.

So, I assume that the add record routine is in your button's OnClick
event,
and it resides in the form's code module, correct? If so, then Me will
work.
If you're not seeing Combo36, then it's either not in the form's code
module, or there's a compile error and that has to be resolved first. Try
compiling and see what happens.


Well, if you changed the code to add records from a command button, per
the
instructions I sent, then that would explain why it's not working from
the
form's AfterUpdate or AfterInsert event: the form is not inserting the
record; you are, though the code. So the AfterUpdate and AfterInsert
events
wouldn't apply.

Just put the combo box requery code at the end of the routine that adds
the
new record, and you should be fine.


I tried that, but I don't know how to reference it, and haven't gotten
around to searching Google for that. "Me" is not pointing to the form
in the add record routine. (There is no "Combo36" in the list after
you type "Me." - like there is in the AfterUpdate routine.) I need to
get a basic book on using Access (just systax, I know how to program -
I've also never used VB before). It took me about 30 minutes
searching Google to find how to change a fields value... (you use the
"clone"...) Do you know of a good/short online reference?




Well, it should work. What's the rowsource of your combo box? Please
copy
and paste it here exactly.

Row Source Type: Table/Query
Row Source: SELECT [Clients].[ClientID], [Clients].[FirstName],
[Clients].[MiddleName], [Clients].[LastName] FROM Clients;

I am adding records from a control button on the form now.

I tested this again, and now the combo box is updated with
Combo36_gotFocus(). I'd prefer to only update that when necessary,
not every time a new record is selected... I don't know why that
works now. The combo box is still not updated with either
Form_AfterInsert() or Form_AfterUpdate().


(SNIP)

Once I use the combo box to select a record, the record selector
count
changes to 1. I can still arrow over to 2 and enter a new record.
When I do that the new record doesn't show up in the combo box
list
(the others still do). If I close the form and reopen it, the
combo
box sees the new record(s).

Well, as John noted, just requery the combo box when a new record is
inserted (I'd do the After Insert event of the form). Just do:

Me.MyComboBox.Requery


I've put that in three places (below). The only thing that updates
the
combo box is closing the form and reopening it.

Private Sub Combo36_GotFocus()
Me.Combo36.Requery
End Sub

Private Sub Form_AfterInsert()
Me.Combo36.Requery
End Sub

Private Sub Form_AfterUpdate()
Me.Combo36.Requery
End Sub


(SNIP)

The above is for if you prompt the user for the PK (customer ID?).
If
the
PK
is an autonumber PK, then you'd do this instead:

=========================================
Dim rs As Recordset

Set rs = CurrentDb.OpenRecordset("MyTable, dbopenDynaset)

rs.AddNew
rs!OtherField = someothervalue 'This is optional.
rs.Update

rs.bookmark = rs.LastModified
Me.Recordsource = "Select * From MyTable Where FieldPK="& rs!FieldPK

rs.close
set rs = nothing
=========================================

That worked. Thanks.


4) While in a code module, go to Tools | References. Uncheck
Microsoft
ActiveX Data Objects (if it's checked). If "Microsoft DAO" is not
checked,
then scroll down the list, and check the highest numbered version of
it.

And that should do it.

Neil


(SNIP)
 
D

Doug

Here's the combo's rowsource:
SELECT [Clients].[ClientID], [Clients].[FullName] FROM Clients ORDER
BY [Clients].[FullName];

Where you place the requery command should have no effect on the sorting of
the combo box. Is you combo explicitly sorted? If so, then this shouldn't be
happening. If not, then there might be some weird glitch with a new record
being at the top, etc. Either way, just make sure you have an explicit sort
in your combo's rowsource, and you should fine.


Your right. I must have made a typo. There's a new problem. The new
record is not sorted in the combo box, it's at the top of the list.
When Me.Combo36.Requery is in the Combo36_GotFocus() routine, the list
is resorted. I did a couple tests, and this behavior is consistent.
(I put the requery just before exit sub in the add record routine.)


OK, we need to back up a second here. You said that the routine I sent to
add a record was working. That routine referenced Me in the
Me.Recordsource=
item. But you write: "'Me' is not pointing to the form in the add record
routine." So, if "Me" is not pointing to the form in the add record
routine,
then how does the Me.Recordsource= line in the add record routine work? If
Me works in one line of the routine, it will work in the other line of the
same routine.

So, I assume that the add record routine is in your button's OnClick
event,
and it resides in the form's code module, correct? If so, then Me will
work.
If you're not seeing Combo36, then it's either not in the form's code
module, or there's a compile error and that has to be resolved first. Try
compiling and see what happens.



Well, if you changed the code to add records from a command button, per
the
instructions I sent, then that would explain why it's not working from
the
form's AfterUpdate or AfterInsert event: the form is not inserting the
record; you are, though the code. So the AfterUpdate and AfterInsert
events
wouldn't apply.

Just put the combo box requery code at the end of the routine that adds
the
new record, and you should be fine.


I tried that, but I don't know how to reference it, and haven't gotten
around to searching Google for that. "Me" is not pointing to the form
in the add record routine. (There is no "Combo36" in the list after
you type "Me." - like there is in the AfterUpdate routine.) I need to
get a basic book on using Access (just systax, I know how to program -
I've also never used VB before). It took me about 30 minutes
searching Google to find how to change a fields value... (you use the
"clone"...) Do you know of a good/short online reference?




Well, it should work. What's the rowsource of your combo box? Please
copy
and paste it here exactly.

Row Source Type: Table/Query
Row Source: SELECT [Clients].[ClientID], [Clients].[FirstName],
[Clients].[MiddleName], [Clients].[LastName] FROM Clients;

I am adding records from a control button on the form now.

I tested this again, and now the combo box is updated with
Combo36_gotFocus(). I'd prefer to only update that when necessary,
not every time a new record is selected... I don't know why that
works now. The combo box is still not updated with either
Form_AfterInsert() or Form_AfterUpdate().


(SNIP)

Once I use the combo box to select a record, the record selector
count
changes to 1. I can still arrow over to 2 and enter a new record.
When I do that the new record doesn't show up in the combo box
list
(the others still do). If I close the form and reopen it, the
combo
box sees the new record(s).

Well, as John noted, just requery the combo box when a new record is
inserted (I'd do the After Insert event of the form). Just do:

Me.MyComboBox.Requery


I've put that in three places (below). The only thing that updates
the
combo box is closing the form and reopening it.

Private Sub Combo36_GotFocus()
Me.Combo36.Requery
End Sub

Private Sub Form_AfterInsert()
Me.Combo36.Requery
End Sub

Private Sub Form_AfterUpdate()
Me.Combo36.Requery
End Sub


(SNIP)

The above is for if you prompt the user for the PK (customer ID?).
If
the
PK
is an autonumber PK, then you'd do this instead:

=========================================
Dim rs As Recordset

Set rs = CurrentDb.OpenRecordset("MyTable, dbopenDynaset)

rs.AddNew
rs!OtherField = someothervalue 'This is optional.
rs.Update

rs.bookmark = rs.LastModified
Me.Recordsource = "Select * From MyTable Where FieldPK="& rs!FieldPK

rs.close
set rs = nothing
=========================================

That worked. Thanks.


4) While in a code module, go to Tools | References. Uncheck
Microsoft
ActiveX Data Objects (if it's checked). If "Microsoft DAO" is not
checked,
then scroll down the list, and check the highest numbered version of
it.

And that should do it.

Neil


(SNIP)
 
N

Neil

No clue. I have no idea why the new record would be at the top of the list
when called from one place, but in the correct sort order when called from
another place. That makes absolutely no sense. Sorry I couldn't be more
helpful here.

Here's the combo's rowsource:
SELECT [Clients].[ClientID], [Clients].[FullName] FROM Clients ORDER
BY [Clients].[FullName];

Where you place the requery command should have no effect on the sorting
of
the combo box. Is you combo explicitly sorted? If so, then this shouldn't
be
happening. If not, then there might be some weird glitch with a new record
being at the top, etc. Either way, just make sure you have an explicit
sort
in your combo's rowsource, and you should fine.


Your right. I must have made a typo. There's a new problem. The new
record is not sorted in the combo box, it's at the top of the list.
When Me.Combo36.Requery is in the Combo36_GotFocus() routine, the list
is resorted. I did a couple tests, and this behavior is consistent.
(I put the requery just before exit sub in the add record routine.)



OK, we need to back up a second here. You said that the routine I sent
to
add a record was working. That routine referenced Me in the
Me.Recordsource=
item. But you write: "'Me' is not pointing to the form in the add record
routine." So, if "Me" is not pointing to the form in the add record
routine,
then how does the Me.Recordsource= line in the add record routine work?
If
Me works in one line of the routine, it will work in the other line of
the
same routine.

So, I assume that the add record routine is in your button's OnClick
event,
and it resides in the form's code module, correct? If so, then Me will
work.
If you're not seeing Combo36, then it's either not in the form's code
module, or there's a compile error and that has to be resolved first.
Try
compiling and see what happens.



Well, if you changed the code to add records from a command button,
per
the
instructions I sent, then that would explain why it's not working from
the
form's AfterUpdate or AfterInsert event: the form is not inserting the
record; you are, though the code. So the AfterUpdate and AfterInsert
events
wouldn't apply.

Just put the combo box requery code at the end of the routine that
adds
the
new record, and you should be fine.


I tried that, but I don't know how to reference it, and haven't gotten
around to searching Google for that. "Me" is not pointing to the form
in the add record routine. (There is no "Combo36" in the list after
you type "Me." - like there is in the AfterUpdate routine.) I need to
get a basic book on using Access (just systax, I know how to program -
I've also never used VB before). It took me about 30 minutes
searching Google to find how to change a fields value... (you use the
"clone"...) Do you know of a good/short online reference?




Well, it should work. What's the rowsource of your combo box? Please
copy
and paste it here exactly.

Row Source Type: Table/Query
Row Source: SELECT [Clients].[ClientID], [Clients].[FirstName],
[Clients].[MiddleName], [Clients].[LastName] FROM Clients;

I am adding records from a control button on the form now.

I tested this again, and now the combo box is updated with
Combo36_gotFocus(). I'd prefer to only update that when necessary,
not every time a new record is selected... I don't know why that
works now. The combo box is still not updated with either
Form_AfterInsert() or Form_AfterUpdate().


(SNIP)

Once I use the combo box to select a record, the record selector
count
changes to 1. I can still arrow over to 2 and enter a new
record.
When I do that the new record doesn't show up in the combo box
list
(the others still do). If I close the form and reopen it, the
combo
box sees the new record(s).

Well, as John noted, just requery the combo box when a new record
is
inserted (I'd do the After Insert event of the form). Just do:

Me.MyComboBox.Requery


I've put that in three places (below). The only thing that updates
the
combo box is closing the form and reopening it.

Private Sub Combo36_GotFocus()
Me.Combo36.Requery
End Sub

Private Sub Form_AfterInsert()
Me.Combo36.Requery
End Sub

Private Sub Form_AfterUpdate()
Me.Combo36.Requery
End Sub


(SNIP)

The above is for if you prompt the user for the PK (customer ID?).
If
the
PK
is an autonumber PK, then you'd do this instead:

=========================================
Dim rs As Recordset

Set rs = CurrentDb.OpenRecordset("MyTable, dbopenDynaset)

rs.AddNew
rs!OtherField = someothervalue 'This is optional.
rs.Update

rs.bookmark = rs.LastModified
Me.Recordsource = "Select * From MyTable Where FieldPK="&
rs!FieldPK

rs.close
set rs = nothing
=========================================

That worked. Thanks.


4) While in a code module, go to Tools | References. Uncheck
Microsoft
ActiveX Data Objects (if it's checked). If "Microsoft DAO" is not
checked,
then scroll down the list, and check the highest numbered version
of
it.

And that should do it.

Neil


(SNIP)
 
D

Doug

Thanks for the links.

I wish one of them had a short section on globally accessing things
that don't happen to to pointed to my "Me."

I find myself working around that, regularly, and just looking for
solutions that don't need to access things outside of "Me." (I checked
the "ten commandments" to make sure I'm not doing something contrary
to the design of Access...)

With my current problem I can't think of a way around not seeing
outside of "Me." I have a check box on a form. If checked, I want the
date to be prefilled on a subform when new records are inserted there.
I can't see the default value propery of the date field in the subform
from the checkbox event on the main form. (I don't know how. I don't
see it under anything that comes up when you type 'me.') So I decided
to set the default value for the table (not the form) in the pop-up
date selector form (the button is on the main form). I get a "runtime
error 2465 - Client database can't find the field '|' referred to in
your expression." (There is no '|' in the expression...) The offending
code is: [Court Dates]![DefaultValue] = Me.DateCtl.Value - so I guess
you can't change default values in tables from within forms in
Microsoft 2000. Being a 'c' programmer, this is rather maddening. I'm
used to being able to easily reference anything in the known universe.
Another thing is I don't know how to reference things on the form that
called the popup from withing the popup. (Another reason I tried
changing the default table value. How do you get the selected date
back to the form?)

A short reference on globally referencing things (all in the same
page, not spread out over 50 pages) would be soooo usefull.

Any help appreciated.
 
D

Doug

(I'm reposting this as it never showed up on my newsfeed.)

Here's the combo's rowsource:
SELECT [Clients].[ClientID], [Clients].[FullName] FROM Clients ORDER
BY [Clients].[FullName];

Where you place the requery command should have no effect on the sorting of
the combo box. Is you combo explicitly sorted? If so, then this shouldn't be
happening. If not, then there might be some weird glitch with a new record
being at the top, etc. Either way, just make sure you have an explicit sort
in your combo's rowsource, and you should fine.


Your right. I must have made a typo. There's a new problem. The new
record is not sorted in the combo box, it's at the top of the list.
When Me.Combo36.Requery is in the Combo36_GotFocus() routine, the list
is resorted. I did a couple tests, and this behavior is consistent.
(I put the requery just before exit sub in the add record routine.)


OK, we need to back up a second here. You said that the routine I sent to
add a record was working. That routine referenced Me in the
Me.Recordsource=
item. But you write: "'Me' is not pointing to the form in the add record
routine." So, if "Me" is not pointing to the form in the add record
routine,
then how does the Me.Recordsource= line in the add record routine work? If
Me works in one line of the routine, it will work in the other line of the
same routine.

So, I assume that the add record routine is in your button's OnClick
event,
and it resides in the form's code module, correct? If so, then Me will
work.
If you're not seeing Combo36, then it's either not in the form's code
module, or there's a compile error and that has to be resolved first. Try
compiling and see what happens.



Well, if you changed the code to add records from a command button, per
the
instructions I sent, then that would explain why it's not working from
the
form's AfterUpdate or AfterInsert event: the form is not inserting the
record; you are, though the code. So the AfterUpdate and AfterInsert
events
wouldn't apply.

Just put the combo box requery code at the end of the routine that adds
the
new record, and you should be fine.


I tried that, but I don't know how to reference it, and haven't gotten
around to searching Google for that. "Me" is not pointing to the form
in the add record routine. (There is no "Combo36" in the list after
you type "Me." - like there is in the AfterUpdate routine.) I need to
get a basic book on using Access (just systax, I know how to program -
I've also never used VB before). It took me about 30 minutes
searching Google to find how to change a fields value... (you use the
"clone"...) Do you know of a good/short online reference?




Well, it should work. What's the rowsource of your combo box? Please
copy
and paste it here exactly.

Row Source Type: Table/Query
Row Source: SELECT [Clients].[ClientID], [Clients].[FirstName],
[Clients].[MiddleName], [Clients].[LastName] FROM Clients;

I am adding records from a control button on the form now.

I tested this again, and now the combo box is updated with
Combo36_gotFocus(). I'd prefer to only update that when necessary,
not every time a new record is selected... I don't know why that
works now. The combo box is still not updated with either
Form_AfterInsert() or Form_AfterUpdate().


(SNIP)

Once I use the combo box to select a record, the record selector
count
changes to 1. I can still arrow over to 2 and enter a new record.
When I do that the new record doesn't show up in the combo box
list
(the others still do). If I close the form and reopen it, the
combo
box sees the new record(s).

Well, as John noted, just requery the combo box when a new record is
inserted (I'd do the After Insert event of the form). Just do:

Me.MyComboBox.Requery


I've put that in three places (below). The only thing that updates
the
combo box is closing the form and reopening it.

Private Sub Combo36_GotFocus()
Me.Combo36.Requery
End Sub

Private Sub Form_AfterInsert()
Me.Combo36.Requery
End Sub

Private Sub Form_AfterUpdate()
Me.Combo36.Requery
End Sub


(SNIP)

The above is for if you prompt the user for the PK (customer ID?).
If
the
PK
is an autonumber PK, then you'd do this instead:

=========================================
Dim rs As Recordset

Set rs = CurrentDb.OpenRecordset("MyTable, dbopenDynaset)

rs.AddNew
rs!OtherField = someothervalue 'This is optional.
rs.Update

rs.bookmark = rs.LastModified
Me.Recordsource = "Select * From MyTable Where FieldPK="& rs!FieldPK

rs.close
set rs = nothing
=========================================

That worked. Thanks.


4) While in a code module, go to Tools | References. Uncheck
Microsoft
ActiveX Data Objects (if it's checked). If "Microsoft DAO" is not
checked,
then scroll down the list, and check the highest numbered version of
it.

And that should do it.

Neil


(SNIP)
 
N

Neil

The original showed up, and I replied to it. Here's my reply in case for
some reason you didn't see it:

No clue. I have no idea why the new record would be at the top of the list
when requery is called from one place, but in the correct sort order when
called from another place. That makes absolutely no sense. Sorry I couldn't
be more helpful here.


(I'm reposting this as it never showed up on my newsfeed.)

Here's the combo's rowsource:
SELECT [Clients].[ClientID], [Clients].[FullName] FROM Clients ORDER
BY [Clients].[FullName];

Where you place the requery command should have no effect on the sorting
of
the combo box. Is you combo explicitly sorted? If so, then this shouldn't
be
happening. If not, then there might be some weird glitch with a new record
being at the top, etc. Either way, just make sure you have an explicit
sort
in your combo's rowsource, and you should fine.


Your right. I must have made a typo. There's a new problem. The new
record is not sorted in the combo box, it's at the top of the list.
When Me.Combo36.Requery is in the Combo36_GotFocus() routine, the list
is resorted. I did a couple tests, and this behavior is consistent.
(I put the requery just before exit sub in the add record routine.)



OK, we need to back up a second here. You said that the routine I sent
to
add a record was working. That routine referenced Me in the
Me.Recordsource=
item. But you write: "'Me' is not pointing to the form in the add record
routine." So, if "Me" is not pointing to the form in the add record
routine,
then how does the Me.Recordsource= line in the add record routine work?
If
Me works in one line of the routine, it will work in the other line of
the
same routine.

So, I assume that the add record routine is in your button's OnClick
event,
and it resides in the form's code module, correct? If so, then Me will
work.
If you're not seeing Combo36, then it's either not in the form's code
module, or there's a compile error and that has to be resolved first.
Try
compiling and see what happens.



Well, if you changed the code to add records from a command button,
per
the
instructions I sent, then that would explain why it's not working from
the
form's AfterUpdate or AfterInsert event: the form is not inserting the
record; you are, though the code. So the AfterUpdate and AfterInsert
events
wouldn't apply.

Just put the combo box requery code at the end of the routine that
adds
the
new record, and you should be fine.


I tried that, but I don't know how to reference it, and haven't gotten
around to searching Google for that. "Me" is not pointing to the form
in the add record routine. (There is no "Combo36" in the list after
you type "Me." - like there is in the AfterUpdate routine.) I need to
get a basic book on using Access (just systax, I know how to program -
I've also never used VB before). It took me about 30 minutes
searching Google to find how to change a fields value... (you use the
"clone"...) Do you know of a good/short online reference?




Well, it should work. What's the rowsource of your combo box? Please
copy
and paste it here exactly.

Row Source Type: Table/Query
Row Source: SELECT [Clients].[ClientID], [Clients].[FirstName],
[Clients].[MiddleName], [Clients].[LastName] FROM Clients;

I am adding records from a control button on the form now.

I tested this again, and now the combo box is updated with
Combo36_gotFocus(). I'd prefer to only update that when necessary,
not every time a new record is selected... I don't know why that
works now. The combo box is still not updated with either
Form_AfterInsert() or Form_AfterUpdate().


(SNIP)

Once I use the combo box to select a record, the record selector
count
changes to 1. I can still arrow over to 2 and enter a new
record.
When I do that the new record doesn't show up in the combo box
list
(the others still do). If I close the form and reopen it, the
combo
box sees the new record(s).

Well, as John noted, just requery the combo box when a new record
is
inserted (I'd do the After Insert event of the form). Just do:

Me.MyComboBox.Requery


I've put that in three places (below). The only thing that updates
the
combo box is closing the form and reopening it.

Private Sub Combo36_GotFocus()
Me.Combo36.Requery
End Sub

Private Sub Form_AfterInsert()
Me.Combo36.Requery
End Sub

Private Sub Form_AfterUpdate()
Me.Combo36.Requery
End Sub


(SNIP)

The above is for if you prompt the user for the PK (customer ID?).
If
the
PK
is an autonumber PK, then you'd do this instead:

=========================================
Dim rs As Recordset

Set rs = CurrentDb.OpenRecordset("MyTable, dbopenDynaset)

rs.AddNew
rs!OtherField = someothervalue 'This is optional.
rs.Update

rs.bookmark = rs.LastModified
Me.Recordsource = "Select * From MyTable Where FieldPK="&
rs!FieldPK

rs.close
set rs = nothing
=========================================

That worked. Thanks.


4) While in a code module, go to Tools | References. Uncheck
Microsoft
ActiveX Data Objects (if it's checked). If "Microsoft DAO" is not
checked,
then scroll down the list, and check the highest numbered version
of
it.

And that should do it.

Neil


(SNIP)
 
N

Neil

With my current problem I can't think of a way around not seeing
outside of "Me." I have a check box on a form. If checked, I want the
date to be prefilled on a subform when new records are inserted there.
I can't see the default value propery of the date field in the subform
from the checkbox event on the main form. (I don't know how. I don't
see it under anything that comes up when you type 'me.')

"Me" is just a shortcut. You don't have to use it. To reference a form (even
the form you're in) you can use the syntax Forms!Formname in place of Me
(where Formname is replaced with your formname).

To reference a subform from within the main form, you would use:
Me.Subformcontrolname.Form to reference the subform (you're basically
referencing the Form property of the subform control, which = the subform
itself). Using the above substitution for Me, if you prefer, you could
instead use Forms!Formname.Subformcontrolname.Form instead of the version
with Me.

You can also reference the main form from the subform, either by using the
Forms!formname syntax (which allows you to open any open form, including the
one containing the subform); or you can just use the Parent property of the
subform to reference the main form, as in: Me.Parent. (Note that though
Forms!formname allows you to reference any open form, you still have to use
the other sytax to reference an open subform).

So, with your above example, I would just reference the parent from the
subform. In the subform's BeforeInsert event, I would add:

If Me.Parent.CheckboxcontrolName Then
Me.Datecontrolname = VBA.Date
End If

If you instead want to set the default property for that field when the
check box is checked, you would just use the above syntax for a subform,
etc. But, for me personally, I prefer the above method of looking at the
check box state at the time the record is entered and just going from there.
So I decided
to set the default value for the table (not the form) in the pop-up
date selector form (the button is on the main form). I get a "runtime
error 2465 - Client database can't find the field '|' referred to in
your expression." (There is no '|' in the expression...) The offending
code is: [Court Dates]![DefaultValue] = Me.DateCtl.Value - so I guess
you can't change default values in tables from within forms in
Microsoft 2000. Being a 'c' programmer, this is rather maddening. I'm
used to being able to easily reference anything in the known universe.

It's just a question of syntax. To change a default table value you'd have
to access the table's Tabledef in the Tabledefs collection and go from
there. But, obviously, that's not needed, and isn't the best way to go.

Really, I understand your frustration. But I think until you sit down and
systematically get up to speed with Access syntax and methodologies you're
going to continue to experience these frustrations. Every platform is
different, as you know. So, even just going through the basics of an intro
to VBA Access programming would be very helpful, you'd fine.
Another thing is I don't know how to reference things on the form that
called the popup from withing the popup. (Another reason I tried
changing the default table value. How do you get the selected date
back to the form?)

In the above you reference a subform; here you're discussing a pop-up.
They're not the same thing. A pop-up form (which is different than a dialog
box) is a standalone form, and you can reference it, or it can reference the
form that opened it, using the Forms!Formname syntax.
A short reference on globally referencing things (all in the same
page, not spread out over 50 pages) would be soooo usefull.

Hopefully the above will help.

Neil
 
W

Wayne Gillespie

On Fri, 23 Nov 2007 04:46:38 -0500, (e-mail address removed) wrote:

Me.NameOfSubformControl.Form!CourtDates.DefaultValue = Me.DateCtl.Value
Thanks for the links.

I wish one of them had a short section on globally accessing things
that don't happen to to pointed to my "Me."

I find myself working around that, regularly, and just looking for
solutions that don't need to access things outside of "Me." (I checked
the "ten commandments" to make sure I'm not doing something contrary
to the design of Access...)

With my current problem I can't think of a way around not seeing
outside of "Me." I have a check box on a form. If checked, I want the
date to be prefilled on a subform when new records are inserted there.
I can't see the default value propery of the date field in the subform
from the checkbox event on the main form. (I don't know how. I don't
see it under anything that comes up when you type 'me.') So I decided
to set the default value for the table (not the form) in the pop-up
date selector form (the button is on the main form). I get a "runtime
error 2465 - Client database can't find the field '|' referred to in
your expression." (There is no '|' in the expression...) The offending
code is: [Court Dates]![DefaultValue] = Me.DateCtl.Value - so I guess
you can't change default values in tables from within forms in
Microsoft 2000. Being a 'c' programmer, this is rather maddening. I'm
used to being able to easily reference anything in the known universe.
Another thing is I don't know how to reference things on the form that
called the popup from withing the popup. (Another reason I tried
changing the default table value. How do you get the selected date
back to the form?)

A short reference on globally referencing things (all in the same
page, not spread out over 50 pages) would be soooo usefull.

Any help appreciated.



Here are my (incomplete) list of useful online references...

Jeff Conrad's resources page:
http://www.accessmvp.com/JConrad/accessjunkie/resources.html

The Access Web resources page:
http://www.mvps.org/access/resources/index.html

A free tutorial written by Crystal (MS Access MVP):
http://allenbrowne.com/casu-22.html

MVP Allen Browne's tutorials:
http://allenbrowne.com/links.html#Tutorials

John W. Vinson [MVP]

Wayne Gillespie
Gosford NSW Australia
 
L

lyle

I wish one of them had a short section on globally accessing things
that don't happen to to pointed to my "Me."

All forms, including subforms can be referenced with
Form_NameofForm,
if they have a module, or if they have their HasModule Property set to
True. I have used these pointers both personally, and in applications
which I have sold and which have run flawlessly thousands and
thousands of times.
The Access community here in CDMA, grudgingly admits that this might
work, but almost universally ignores it.
Possibly they get paid by the word, and love
Forms("ThisForm").Controls("TheSubFromControl").Forms("NameofSubForm").Controls("NameofSUbFormControl").Value .
Some even put in some "Bang" nonsense, a device designed to make the
syntax even more confusing, and to discourage learners from becoming
capable in programming.
Possibly they get laid when they can show their lover that they are
actually able to traverse this long passage of idiocy.
This is their right and yours as well.

I will continue to use Form_SuBFormName.ControlName.Value (or
BackColor or other Property).

Yes, this works with Report_ReportName, but with the caution that it's
difficult to change anything on a report while it's being rendered.
 
R

Rick Brandt

lyle said:
All forms, including subforms can be referenced with
Form_NameofForm,
if they have a module, or if they have their HasModule Property set to
True. I have used these pointers both personally, and in applications
which I have sold and which have run flawlessly thousands and
thousands of times.
The Access community here in CDMA, grudgingly admits that this might
work, but almost universally ignores it.
Possibly they get paid by the word, and love
Forms("ThisForm").Controls("TheSubFromControl").Forms("NameofSubForm").Controls("NameofSUbFormControl").Value
.
Some even put in some "Bang" nonsense, a device designed to make the
syntax even more confusing, and to discourage learners from becoming
capable in programming.
Possibly they get laid when they can show their lover that they are
actually able to traverse this long passage of idiocy.
This is their right and yours as well.

I will continue to use Form_SuBFormName.ControlName.Value (or
BackColor or other Property).

Yes, this works with Report_ReportName, but with the caution that it's
difficult to change anything on a report while it's being rendered.

It is all well and good that you have found a syntax that works for you, but I
fail to see why you must assign queer motives or incompetence to anyone who uses
any other.

In a simple test...

?Forms!Form1.AllowFilters
True

?Form_Form1.AllowFilters
Run-time error '2467'
The expression you entered refers to an object that is closed or doesn't exist.

The form in question IS open and has a module. Admittedly, the following all do
work...

?Form_Form1.section(0).Height
?Form_Form1.Width
?Form_Form1.Controls.Count

Further testing reveals that the Form_FormName syntax does not work in Queries
whereas Forms!FormName does.

So it seems that the Form_FormName syntax *often* works, but not always. Just
my preference, but given a syntax that work most of the time versus one that
works all the time I prefer to use the latter even in specific situations where
the former would work. I simply see no reason for introducing an inconsistency.

In addition; within the context of these groups answering a question with the
Form_FormName syntax (even when it works) is likely to just raise additional
questions because of its non-familiarity whereas most people will recognize
Forms!FormName.

As for "paid by the word" ?Form_Form1.Controls.Count and
?Forms!Form1.Controls.Count differ by exactly one character. You were the one
to introduce into the conversation the more verbose Forms("FormName") variation
so that is a straw man. I fully concede the point when making references to
subforms. In that case Form_FormName is definitely fewer keystrokes, but one
can also consider the rare situation where a form could be used as a subform
more than once at the same time and I believe in that case the Form_FormName
syntax fails since it cannot distinguish between the multiple instances.

Finally, if there are people who use Forms!FormName simply because that is what
they are familiar with and because that is what they see in all of the help file
examples and in the majority of code snippets they see on the internet then just
what exactly is wrong with that? Are you basing the superiority of your
preference solely on keystroke count? Because it is more modern? Just because
I can cook scrambled eggs in a microwave yet still choose to do so in a frying
pan doesn't mean I am ignorant or dismissive of microwave technology. It might
just mean that I am used to cooking them in a pan and prefer doing it that way.
 
L

lyle

?Form_Form1.AllowFilters
Run-time error '2467'
The expression you entered refers to an object that is closed or doesn't exist.

A quick check here:

Sub temp()
Debug.Print Form_Employees.AllowFilters
End Sub

True is printed in the Immediate Window.
 
R

rkc

lyle said:
A quick check here:

Sub temp()
Debug.Print Form_Employees.AllowFilters
End Sub

True is printed in the Immediate Window.

Suppose you have two instances of a form open
and want to refer to the controls on a form contained
in a subform control on the form. If you use Form_FormName
which instance of the form is being referenced?
 
D

Doug

Thanks for the explanation.

I had thought parent might be right, but I didn't get a drop-down
after typing '...parent.' and the code wasn't working, and I didn't
know why. I was using the 'got focus' (and I tried 'on insert') event
in the subform, and then setting the default of the date field to the
date field on the main form. (Ignoring the check box for now.) That
doesn't work. The date field doesn't fill in. I changed it to the 'on
double click' event of the date field (setting the actual field and
not the default), and now it works.

My problem with referencing the form from the popup was I wasn't
including the 'Form!' in front of 'FormName!FieldName.'

I appreciate your help.


With my current problem I can't think of a way around not seeing
outside of "Me." I have a check box on a form. If checked, I want the
date to be prefilled on a subform when new records are inserted there.
I can't see the default value propery of the date field in the subform
from the checkbox event on the main form. (I don't know how. I don't
see it under anything that comes up when you type 'me.')

"Me" is just a shortcut. You don't have to use it. To reference a form (even
the form you're in) you can use the syntax Forms!Formname in place of Me
(where Formname is replaced with your formname).

To reference a subform from within the main form, you would use:
Me.Subformcontrolname.Form to reference the subform (you're basically
referencing the Form property of the subform control, which = the subform
itself). Using the above substitution for Me, if you prefer, you could
instead use Forms!Formname.Subformcontrolname.Form instead of the version
with Me.

You can also reference the main form from the subform, either by using the
Forms!formname syntax (which allows you to open any open form, including the
one containing the subform); or you can just use the Parent property of the
subform to reference the main form, as in: Me.Parent. (Note that though
Forms!formname allows you to reference any open form, you still have to use
the other sytax to reference an open subform).

So, with your above example, I would just reference the parent from the
subform. In the subform's BeforeInsert event, I would add:

If Me.Parent.CheckboxcontrolName Then
Me.Datecontrolname = VBA.Date
End If

If you instead want to set the default property for that field when the
check box is checked, you would just use the above syntax for a subform,
etc. But, for me personally, I prefer the above method of looking at the
check box state at the time the record is entered and just going from there.
So I decided
to set the default value for the table (not the form) in the pop-up
date selector form (the button is on the main form). I get a "runtime
error 2465 - Client database can't find the field '|' referred to in
your expression." (There is no '|' in the expression...) The offending
code is: [Court Dates]![DefaultValue] = Me.DateCtl.Value - so I guess
you can't change default values in tables from within forms in
Microsoft 2000. Being a 'c' programmer, this is rather maddening. I'm
used to being able to easily reference anything in the known universe.

It's just a question of syntax. To change a default table value you'd have
to access the table's Tabledef in the Tabledefs collection and go from
there. But, obviously, that's not needed, and isn't the best way to go.

Really, I understand your frustration. But I think until you sit down and
systematically get up to speed with Access syntax and methodologies you're
going to continue to experience these frustrations. Every platform is
different, as you know. So, even just going through the basics of an intro
to VBA Access programming would be very helpful, you'd fine.
Another thing is I don't know how to reference things on the form that
called the popup from withing the popup. (Another reason I tried
changing the default table value. How do you get the selected date
back to the form?)

In the above you reference a subform; here you're discussing a pop-up.
They're not the same thing. A pop-up form (which is different than a dialog
box) is a standalone form, and you can reference it, or it can reference the
form that opened it, using the Forms!Formname syntax.
A short reference on globally referencing things (all in the same
page, not spread out over 50 pages) would be soooo usefull.

Hopefully the above will help.

Neil


Any help appreciated.
 
N

Neil

Thanks for the explanation.

I had thought parent might be right, but I didn't get a drop-down
after typing '...parent.'

Yes, you won't get the dropdown after parent, since it could be a form or a
report. If you absolutely want a dropdown (not saying you do, but if you
do), you can assign me.parent to a form object as follows:

Dim frm as form

set frm = me.parent

.... stuff...

set frm = nothing 'at the end

That would give you the dropdown. If you declare frm as the actual form
that's the parent, you'll also get references to the specific controls on
the form:

Dim frm as form_MyParentFormName

set frm = me.parent

....

Just fyi.

and the code wasn't working, and I didn't
know why. I was using the 'got focus' (and I tried 'on insert') event
in the subform, and then setting the default of the date field to the
date field on the main form. (Ignoring the check box for now.) That
doesn't work.

Yes, because the default value of the field has to be set before the record
is added. When I said to use the BeforeInsert event of the subform, I said
to just set the field's value in that event, not set its default value.
The date field doesn't fill in. I changed it to the 'on
double click' event of the date field (setting the actual field and
not the default), and now it works.

Right, because you're setting the actual field value. You could do that in
the BeforeInsert, instead, and save the double-click effort. Either way.
My problem with referencing the form from the popup was I wasn't
including the 'Form!' in front of 'FormName!FieldName.'

I appreciate your help.

No problem. Glad you got it working.

Neil

With my current problem I can't think of a way around not seeing
outside of "Me." I have a check box on a form. If checked, I want the
date to be prefilled on a subform when new records are inserted there.
I can't see the default value propery of the date field in the subform
from the checkbox event on the main form. (I don't know how. I don't
see it under anything that comes up when you type 'me.')

"Me" is just a shortcut. You don't have to use it. To reference a form
(even
the form you're in) you can use the syntax Forms!Formname in place of Me
(where Formname is replaced with your formname).

To reference a subform from within the main form, you would use:
Me.Subformcontrolname.Form to reference the subform (you're basically
referencing the Form property of the subform control, which = the subform
itself). Using the above substitution for Me, if you prefer, you could
instead use Forms!Formname.Subformcontrolname.Form instead of the version
with Me.

You can also reference the main form from the subform, either by using the
Forms!formname syntax (which allows you to open any open form, including
the
one containing the subform); or you can just use the Parent property of
the
subform to reference the main form, as in: Me.Parent. (Note that though
Forms!formname allows you to reference any open form, you still have to
use
the other sytax to reference an open subform).

So, with your above example, I would just reference the parent from the
subform. In the subform's BeforeInsert event, I would add:

If Me.Parent.CheckboxcontrolName Then
Me.Datecontrolname = VBA.Date
End If

If you instead want to set the default property for that field when the
check box is checked, you would just use the above syntax for a subform,
etc. But, for me personally, I prefer the above method of looking at the
check box state at the time the record is entered and just going from
there.
So I decided
to set the default value for the table (not the form) in the pop-up
date selector form (the button is on the main form). I get a "runtime
error 2465 - Client database can't find the field '|' referred to in
your expression." (There is no '|' in the expression...) The offending
code is: [Court Dates]![DefaultValue] = Me.DateCtl.Value - so I guess
you can't change default values in tables from within forms in
Microsoft 2000. Being a 'c' programmer, this is rather maddening. I'm
used to being able to easily reference anything in the known universe.

It's just a question of syntax. To change a default table value you'd have
to access the table's Tabledef in the Tabledefs collection and go from
there. But, obviously, that's not needed, and isn't the best way to go.

Really, I understand your frustration. But I think until you sit down and
systematically get up to speed with Access syntax and methodologies you're
going to continue to experience these frustrations. Every platform is
different, as you know. So, even just going through the basics of an intro
to VBA Access programming would be very helpful, you'd fine.
Another thing is I don't know how to reference things on the form that
called the popup from withing the popup. (Another reason I tried
changing the default table value. How do you get the selected date
back to the form?)

In the above you reference a subform; here you're discussing a pop-up.
They're not the same thing. A pop-up form (which is different than a
dialog
box) is a standalone form, and you can reference it, or it can reference
the
form that opened it, using the Forms!Formname syntax.
A short reference on globally referencing things (all in the same
page, not spread out over 50 pages) would be soooo usefull.

Hopefully the above will help.

Neil


Any help appreciated.



On Mon, 19 Nov 2007 12:05:32 -0700, John W. Vinson


No, I'm not familiar with an online reference, though someone else here
might be. I would just go to my local Barnes and Noble or Borders and
pick
up a beginning or intermediate Access programming book.

Here are my (incomplete) list of useful online references...

Jeff Conrad's resources page:
http://www.accessmvp.com/JConrad/accessjunkie/resources.html

The Access Web resources page:
http://www.mvps.org/access/resources/index.html

A free tutorial written by Crystal (MS Access MVP):
http://allenbrowne.com/casu-22.html

MVP Allen Browne's tutorials:
http://allenbrowne.com/links.html#Tutorials

John W. Vinson [MVP]
 
L

lyle

Suppose you have two instances of a form open
and want to refer to the controls on a form contained
in a subform control on the form. If you use Form_FormName
which instance of the form is being referenced?

I don't know. Sometime when I consider it either worthwhile to have
two instances of a form open (with the form having a subform), or
likely that it will happen I'll check into it.
How is done using the [long idiotic string from hell] syntax?

I generally don't use subforms any more as the use of the syntax I
have suggested facilitates using full forms as sub forms ... with none
of the limitations of subforms.

When I use multiple instances of forms it is through code like:

Dim ADetailForms(0 To 1) As [Form_Faculty Details]
Public Sub OpenSomeFormInstances()
Dim z As Long
For z = 0 To 1
Set ADetailForms(z) = New [Form_Faculty Details]
With ADetailForms(z)
.Visible = True
.Caption = "Look Ma Multiple Distinguishable Instances of
a Form " & z
End With
Next z
End Sub

Public Sub ZapAllThoseFormInstances()
Erase ADetailForms
End Sub
 

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