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

5 Tabs, 1 Combo and something quite strange.

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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.