473,387 Members | 1,876 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

combo / form help please

Hello All,

I am new to Access and have been looking for answers to my problem on
the internet and have not found it yet. I hope someone can give me a
hint. Thanks so much.

I have a form (called: myform) in which there is a combo (combo1) and a
button (button1). In properties for combo1, I use "Value List" for Row
Source Type and in Row Source : "0000-0999";"1000-1999". So when the
form first load, in the combo1, there are 2 values in the drop-down
list which are: 0000-0999 and the second one is: 1000-1999. What I
want to do is that when I select the "0000-0999" value and click on the
'button1' button, a form(form1) will pops up in which there are many
columns and one column will have value from 0001 to 0999. The data are
stored in a table called: table1 (with fields like serial_no,
part_name, etc) .

I would appreciate a lot if anyone can give me a hint or show me where
to check for similar example.

Sincerely,
Teresa

Nov 13 '05 #1
10 1993
You don't need the button! Put the following code in the AfterUpdate event
of the combobox:
Select Case Me!Combo1
Case "0000-0999"
DoCmd.openForm "Form1"
Case "1000-1999"
<Do Something Here>
Case Else 'In Case You Add More Options To Value List
<Do Something Here>
End Select

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"motessa" <le******@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Hello All,

I am new to Access and have been looking for answers to my problem on
the internet and have not found it yet. I hope someone can give me a
hint. Thanks so much.

I have a form (called: myform) in which there is a combo (combo1) and a
button (button1). In properties for combo1, I use "Value List" for Row
Source Type and in Row Source : "0000-0999";"1000-1999". So when the
form first load, in the combo1, there are 2 values in the drop-down
list which are: 0000-0999 and the second one is: 1000-1999. What I
want to do is that when I select the "0000-0999" value and click on the
'button1' button, a form(form1) will pops up in which there are many
columns and one column will have value from 0001 to 0999. The data are
stored in a table called: table1 (with fields like serial_no,
part_name, etc) .

I would appreciate a lot if anyone can give me a hint or show me where
to check for similar example.

Sincerely,
Teresa

Nov 13 '05 #2
On Tue, 04 Oct 2005 01:43:48 GMT, "PC Datasheet" <no****@nospam.spam>
wrote:

Select Case Me!Combo1
Case "0000-0999"
DoCmd.openForm "Form1",,,"Serial_No between '0000' and '0999'
Case "1000-1999"
DoCmd.openForm "Form1",,,"Serial_No between '1000' and '1999'
Case Else 'In Case You Add More Options To Value List
<Do Something Here>
End Select

Then Form1 would have a recordsource of:
Table1
(or better: a query based on Table1)

-Tom.

You don't need the button! Put the following code in the AfterUpdate event
of the combobox:
Select Case Me!Combo1
Case "0000-0999"
DoCmd.openForm "Form1"
Case "1000-1999"
<Do Something Here>
Case Else 'In Case You Add More Options To Value List
<Do Something Here>
End Select


Nov 13 '05 #3
Hi Tom,

I will give it a try today. Many thanks!

Have a great day,

Teresa

Nov 13 '05 #4
Hi Tom and PC,

Thank you for your great help. My form worked perfectly, just like you
said. Thanks so much.

Another question, if you have time. If I want to specify another value
for another column, let's say the field name is "Part Name" and I have
to retrieve the "part name" from a different table:

Table1:
serial_no | part_no |
0001 | 1000 |

Table 2:
part_no | part_name |
1000 | part 1 |

How do I modify the code to display value for another column (Part
Name)?

Sorry to ask too much,

Teresa

Nov 13 '05 #5
Why not just include part_name in Table1?

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"motessa" <le******@yahoo.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Hi Tom and PC,

Thank you for your great help. My form worked perfectly, just like you
said. Thanks so much.

Another question, if you have time. If I want to specify another value
for another column, let's say the field name is "Part Name" and I have
to retrieve the "part name" from a different table:

Table1:
serial_no | part_no |
0001 | 1000 |

Table 2:
part_no | part_name |
1000 | part 1 |

How do I modify the code to display value for another column (Part
Name)?

Sorry to ask too much,

Teresa

Nov 13 '05 #6
Hi PC,

The tables are much more complicated than that and I am not the person
who controls
how many fields in a database so I don't know why. Somebody else
designs these tables.
Thanks for your help a lot. I am so new to Access!

Teresa

Nov 13 '05 #7
It sounds like you need some redesign of your tables! Poor design of the
tables in a database and lead to progressively more and more problems in the
database. If you need some outside help with your database I specialize in
that type of assistance. My fees are very reasonable.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"motessa" <le******@yahoo.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Hi PC,

The tables are much more complicated than that and I am not the person
who controls
how many fields in a database so I don't know why. Somebody else
designs these tables.
Thanks for your help a lot. I am so new to Access!

Teresa

Nov 13 '05 #8
Thanks PC for your suggestion. If my group needs your help, I will let
you know.

Regards,
Teresa

Nov 13 '05 #9
Teresa,

I would suggest that the combobox have AfterUpdate with code behind the
form that updates two invisible controls called something like MinValue
and MaxValue:

Select Case combo1
Case "0000-0999"
MinValue = "0000"
MaxValue = "0999"
Case "1000-1999"
MinValue = "1000"
MaxValue = "1999"
End Select

And then for the criteria for the field in question in the query:
Between Forms!MyForm!MinValue And Forms!MyForm!MaxValue

And the rest of this answer is more about the query by form concept in
general but not necessarily using your particular control names.

Here's something I put together that may give you some ideas about
making time periods and other criteria dynamic.

The free downloadable sample database at www.bullschmidt.com/access
uses the query by form concept so that on the invoices dialog one can
optionally choose a rep, a customer, and perhaps a date range, click on
a button that says "Input," and then have the invoice form open up
showing all the invoices that match the criteria.

And here is how the query by form concept can work.

On the invoices dialog there are the following controls:
InvDateMin with DefaultValue of =DateSerial(Year(Date())-1,1,1)
InvDateMax with DefaultValue of =Date()
InvRepNum with DefaultValue of *
InvCustNum with DefaultValue of *

Also on the invoices dialog there is a command button called cmdInput
to open the invoices form with the following code behind the OnClick
property:
DoCmd.OpenForm "frmInv"

And of course there could be a button to open a report the same way:
DoCmd.OpenReport "rptInv", acViewPreview

The invoices form (frmInv) has RecordSource property of qryInv.

And the qryInv query's criteria for the InvDate field has:
Between [Forms]![frmInvDialog]![InvDateMin] And
[Forms]![frmInvDialog]![InvDateMax]

And the qryInv query's criteria for the RepNum field has:
Like [Forms]![frmInvDialog]![InvRepNum]

And the qryInv query's criteria for the CustNum field has:
Like [Forms]![frmInvDialog]![CustNum]

One related point is that you probably wouldn't want to allow blanks
(i.e. Nulls) in fields that are going to be used with Like in any
criteria for that field. Otherwise the blanks wouldn't be shown.

For example (based on what is entered into a last name search field):

Like 'Smith' would show Smith records

Like '' would show no records (probably not what one would want)

Like '*' would show all records

And to counter that I like to have the search fields have a
DefaultValue of * and not allow the search fields to be blank.

Best regards,
J. Paul Schmidt, Freelance Web and Database Developer
http://www.Bullschmidt.com
Access Database Sample, Web Database Sample, ASP Design Tips

<<
I am new to Access and have been looking for answers to my problem on
the internet and have not found it yet. I hope someone can give me a
hint. Thanks so much.

I have a form (called: myform) in which there is a combo (combo1) and a

button (button1). In properties for combo1, I use "Value List" for Row
Source Type and in Row Source : "0000-0999";"1000-1999". So when the
form first load, in the combo1, there are 2 values in the drop-down
list which are: 0000-0999 and the second one is: 1000-1999. What I
want to do is that when I select the "0000-0999" value and click on the

'button1' button, a form(form1) will pops up in which there are many
columns and one column will have value from 0001 to 0999. The data are
stored in a table called: table1 (with fields like serial_no,
part_name, etc) .
I would appreciate a lot if anyone can give me a hint or show me where

to check for similar example.


Nov 13 '05 #10
Hi Paul,

Thanks for all your help. I will follow your suggestions. Hope you have
a wonderful day.

Much appreciated,
Teresa

Nov 13 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Heather | last post by:
Hi I am desparately looking for advice in relation to storing the results after selecting items from two combo boxes on a Referral form. The first combo box 'ctl Type' displays a full list of...
1
by: Robert Neville | last post by:
The solution to my dilemma seems straight-forward, yet my mind has not been forthcoming with a direct route. My Project form has a tab control with multiple sub-forms; these distinct sub-forms...
3
by: pelcovits | last post by:
I am trying to set up an unbound form to enter report criteria. I've followed the MS Office Assistance document: "Create a form to enter report criteria" which describes how to enter data (such...
10
by: Richard | last post by:
I have created a form which sets up a dataview. The form views one record at a time using a currencymanager. This works fine. All my text boxes bind. However I have a combo box which gets its...
9
by: Edwinah63 | last post by:
Hi everyone, Please let there be someone out there who can help. I have two BOUND combo boxes on a continuous form, the second being dependent on the first. I have no problem getting the...
7
by: sara | last post by:
I have a form where the user selects an item from a list box, and then works on that item. The user chooses an AD, then opens a form to assign departments to the ad. The top of the Depts form has...
0
by: Jeremy Wallace | last post by:
Folks, Here's a write-up I did for our developer wiki. I don't know if the whole rest of the world has already figured out how to do this, but I hadn't ever seen it implemented, and had spent a...
1
by: zack | last post by:
I am really struggling to get to grips with this issue, would grateful for any advice. I have a form 'Applicant_Person' with various student contact data. There is a combo box to 2 options of...
3
by: Torilyn73 | last post by:
I posted this earlier... or thought I did... anyway.. it's doesn't appear in the list so I'm reposting it. Can someone please explain to me how to set up the lostfocus event for a combo box. I...
4
by: whamo | last post by:
I have the need to populate a field based on the selection in a combo box. Starting out simple. (2) tables tbl_OSE_Info and tbl_Input; tbl_OSE_Info has three fields: Key, OSE_Name and OSE_Wt...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.