469,935 Members | 2,225 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,935 developers. It's quick & easy.

5 Tabs, 1 Combo and something quite strange.

Hi All,

I have a form with a standard combo box and 5 tabs in A2003.

On Form Open, I set Me.Detail.Visible = False and in the after update
event of the combo set Me.Detail.Visible = True,( to open form with no
info showing ) I've noticed something quite strange.

I open the form ( details are not visible ) select any record ID with
the combo and the details come up OK. I click anywhere on the
tabcontrol and it immediately goes back to the first record ( ID 1 ).I
select a different ID with the combo and all is well.

Now, if I start again and open the form, select any ID from the combo
and let those details come up then immediately select a different ID
from the combo box, I can now click on the tab control and all is
well.

If I leave the form detail as the default ie Visible, no problems.

Any ideas as to why the clicking the tab control under these
circumstances whould throw back to the first record in the
recordsource table?
Is there a more efficient and elegant way of opening a form as blank,
and only showing the records once the user has selected a record ID?

Regards

Karl
Nov 13 '05 #1
3 1286
Hi Karl

Some ways to open a form so it is blank:

a) Filter to a condition that is False for all records:
Private Sub Form_Open(Cancel As Integer)
Me.Filter = "(False)"
Me.FilterOn = True
End Sub

b) Go straight to a new record:
Private Sub Form_Load()
If Not Me.NewRecord Then
RunCommand acCmdRecordsGotoNew
End If
End Sub

c) Change the RecordSource of the form.
Save the form as:
SELECT * FROM MyTable WHERE (False);
In the AfterUpdate of your combo:
Private Sub Me.cbo1_AfterUpdate()
Dim strSql As String
If IsNull(Me.cbo1) Then
strSql = "SELECT * FROM MyTable WHERE (False);"
Else
strSql = "SELECT * FROM MyTable WHERE MyField = " & Me.cbo1 &
";"
End If
Me.RecordSource = strSql
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Karl Roes" <ka******@hotmail.com> wrote in message
news:7c**************************@posting.google.c om...
Hi All,

I have a form with a standard combo box and 5 tabs in A2003.

On Form Open, I set Me.Detail.Visible = False and in the after update
event of the combo set Me.Detail.Visible = True,( to open form with no
info showing ) I've noticed something quite strange.

I open the form ( details are not visible ) select any record ID with
the combo and the details come up OK. I click anywhere on the
tabcontrol and it immediately goes back to the first record ( ID 1 ).I
select a different ID with the combo and all is well.

Now, if I start again and open the form, select any ID from the combo
and let those details come up then immediately select a different ID
from the combo box, I can now click on the tab control and all is
well.

If I leave the form detail as the default ie Visible, no problems.

Any ideas as to why the clicking the tab control under these
circumstances whould throw back to the first record in the
recordsource table?
Is there a more efficient and elegant way of opening a form as blank,
and only showing the records once the user has selected a record ID?

Regards

Karl

Nov 13 '05 #2
Hi Allen,

Changing the forms RecordSource looks a winner. Will reply with the outcome.

Thanks Allen

Karl.

"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message news:<41**********************@per-qv1-newsreader-01.iinet.net.au>...
Hi Karl

Some ways to open a form so it is blank:

a) Filter to a condition that is False for all records:
Private Sub Form_Open(Cancel As Integer)
Me.Filter = "(False)"
Me.FilterOn = True
End Sub

b) Go straight to a new record:
Private Sub Form_Load()
If Not Me.NewRecord Then
RunCommand acCmdRecordsGotoNew
End If
End Sub

c) Change the RecordSource of the form.
Save the form as:
SELECT * FROM MyTable WHERE (False);
In the AfterUpdate of your combo:
Private Sub Me.cbo1_AfterUpdate()
Dim strSql As String
If IsNull(Me.cbo1) Then
strSql = "SELECT * FROM MyTable WHERE (False);"
Else
strSql = "SELECT * FROM MyTable WHERE MyField = " & Me.cbo1 &
";"
End If
Me.RecordSource = strSql
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Karl Roes" <ka******@hotmail.com> wrote in message
news:7c**************************@posting.google.c om...
Hi All,

I have a form with a standard combo box and 5 tabs in A2003.

On Form Open, I set Me.Detail.Visible = False and in the after update
event of the combo set Me.Detail.Visible = True,( to open form with no
info showing ) I've noticed something quite strange.

I open the form ( details are not visible ) select any record ID with
the combo and the details come up OK. I click anywhere on the
tabcontrol and it immediately goes back to the first record ( ID 1 ).I
select a different ID with the combo and all is well.

Now, if I start again and open the form, select any ID from the combo
and let those details come up then immediately select a different ID
from the combo box, I can now click on the tab control and all is
well.

If I leave the form detail as the default ie Visible, no problems.

Any ideas as to why the clicking the tab control under these
circumstances whould throw back to the first record in the
recordsource table?
Is there a more efficient and elegant way of opening a form as blank,
and only showing the records once the user has selected a record ID?

Regards

Karl

Nov 13 '05 #3
Hi,

Success!!

Thanks Allen

Karl.

ka******@hotmail.com (Karl Roes) wrote in message news:<7c**************************@posting.google. com>...
Hi Allen,

Changing the forms RecordSource looks a winner. Will reply with the outcome.

Thanks Allen

Karl.

"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message news:<41**********************@per-qv1-newsreader-01.iinet.net.au>...
Hi Karl

Some ways to open a form so it is blank:

a) Filter to a condition that is False for all records:
Private Sub Form_Open(Cancel As Integer)
Me.Filter = "(False)"
Me.FilterOn = True
End Sub

b) Go straight to a new record:
Private Sub Form_Load()
If Not Me.NewRecord Then
RunCommand acCmdRecordsGotoNew
End If
End Sub

c) Change the RecordSource of the form.
Save the form as:
SELECT * FROM MyTable WHERE (False);
In the AfterUpdate of your combo:
Private Sub Me.cbo1_AfterUpdate()
Dim strSql As String
If IsNull(Me.cbo1) Then
strSql = "SELECT * FROM MyTable WHERE (False);"
Else
strSql = "SELECT * FROM MyTable WHERE MyField = " & Me.cbo1 &
";"
End If
Me.RecordSource = strSql
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Karl Roes" <ka******@hotmail.com> wrote in message
news:7c**************************@posting.google.c om...
Hi All,

I have a form with a standard combo box and 5 tabs in A2003.

On Form Open, I set Me.Detail.Visible = False and in the after update
event of the combo set Me.Detail.Visible = True,( to open form with no
info showing ) I've noticed something quite strange.

I open the form ( details are not visible ) select any record ID with
the combo and the details come up OK. I click anywhere on the
tabcontrol and it immediately goes back to the first record ( ID 1 ).I
select a different ID with the combo and all is well.

Now, if I start again and open the form, select any ID from the combo
and let those details come up then immediately select a different ID
from the combo box, I can now click on the tab control and all is
well.

If I leave the form detail as the default ie Visible, no problems.

Any ideas as to why the clicking the tab control under these
circumstances whould throw back to the first record in the
recordsource table?
Is there a more efficient and elegant way of opening a form as blank,
and only showing the records once the user has selected a record ID?

Regards

Karl

Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Jeff Mason | last post: by
135 posts views Thread by Xah Lee | last post: by
10 posts views Thread by Tom | last post: by
35 posts views Thread by Ben | last post: by
2 posts views Thread by biganthony via AccessMonster.com | last post: by
7 posts views Thread by Brad Pears | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.