CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> CodeCharge.Discussion

 Changing type listbox to label

Print topic Send  topic

Author Message
Jim Ryan
Posted: 07/14/2001, 6:04 AM

Hi All,

I just downloaded and installed the latest version (Beta 4). Great job guys!
Anyhow, I created an entry form from a previous version (1.2) compiling to
ASP and using MSAccess. Using the Autonumber feature in MSAccess, it
automatically assigns the next number to the main table and this is the
number I've been using to show the different records. Since you can't show
the next number on the input form with MSAccess, (Believe me, I spent hours
trying to use the DLookup function and the MAX() functions and had no luck)
so I created a blank field called field1, with the Type set to listbox.
Under field properties | list, it is joined to another table called
nextnumber, with a primary key / id and showing / nextnum with only one
record in it. In the form properties under events | after insert, I put
coding in to update the nextnumber table, nextnum+1. Now when the user opens
the entry form the next number is now shown in a listbox with only one
number in it. (I know, it isn't pretty, but it works! ;-). When the user
clicks the add button, it adds the record to the main table and also updates
the nextnumber table to show the next number. Whew!. Ok, now the problem.
When I changed the field type to label and click on the field properties |
join, and process the page, it doesn't show the next number. It only works
with the listbox. I also tried changing the field type to textbox, but
unfortunately you don't get the join or list feature. That may be a good one
for the wish list! Any help would be appreciated.

Jim

Ken Hardwick
Posted: 07/14/2001, 9:00 AM

Jim Ryan,

Here is sql code that I just wrote this am to get the next available
number...I am using this with Access..and could had used autonumber
but may be moving my app to oracle so just wrote this instead...



kenSQL = ""
KenSQL = "SELECT max(user_num)+1 as NextNum"
KenSQL = kenSQL + " FROM Prj_Names "
kenRST = cn.execute(kenSQL)

if isnull(kenRst("NextNum")) then
fldUser_Num = "1"
else
fldUser_Num = kenRst("NextNum")
end if

set kenRSt = Nothing

Just put this in your "before show event"

Hope this helps....

Ken Hardwick
Norman,OK
KenHardwick@visto.com



Jim Ryan wrote in message <9ipg1o$8cq$1@news.codecharge.com>...
>Hi All,
>
>I just downloaded and installed the latest version (Beta 4). Great job
guys!
>Anyhow, I created an entry form from a previous version (1.2) compiling to
>ASP and using MSAccess. Using the Autonumber feature in MSAccess, it
>automatically assigns the next number to the main table and this is the
>number I've been using to show the different records. Since you can't show
>the next number on the input form with MSAccess, (Believe me, I spent hours
>trying to use the DLookup function and the MAX() functions and had no luck)
>so I created a blank field called field1, with the Type set to listbox.
>Under field properties | list, it is joined to another table called
>nextnumber, with a primary key / id and showing / nextnum with only one
>record in it. In the form properties under events | after insert, I put
>coding in to update the nextnumber table, nextnum+1. Now when the user
opens
>the entry form the next number is now shown in a listbox with only one
>number in it. (I know, it isn't pretty, but it works! ;-). When the user
>clicks the add button, it adds the record to the main table and also
updates
>the nextnumber table to show the next number. Whew!. Ok, now the problem.
>When I changed the field type to label and click on the field properties |
>join, and process the page, it doesn't show the next number. It only works
>with the listbox. I also tried changing the field type to textbox, but
>unfortunately you don't get the join or list feature. That may be a good
one
>for the wish list! Any help would be appreciated.
>
>Jim
>
>

Frank Rocco
Posted: 07/14/2001, 10:38 AM

Hi Jim,

I don't think this would work well in a multi-user setting.

What if user 1 has cust 100 up for insert
and user 2 has cust 101 up for insert.
Won't both users show the same user_num?
If not please explain.

Thanks
Frank

CodeCharge
Posted: 07/14/2001, 8:02 PM

I use couple "reliable" ways of obtaining the key of the last created
record:

1.
Assuming that the user creates new article, I require that the article Title
is unique, ie. it can't already exist in the databse.
This can be done simply by checking "Unique" checkbox in field properties.
Then in the "After Insert" Event I search for the article title just entered
and create session variable based on it:
session("ArticleID") = DLookup("articles","article_id","article_title=" &
ToSQL(fldarticle_title,"text"))
That way I have session variable "ArticleID" available later on the next
page.

Again, this is assuming that I don't allow 2 records with identical titles.
If I do want to allow users to create duplicate titles, etc., then:

2.
I add "user_id" field to the table that I want users to update.
Then in the "After Insert" Event I can use the Max function, for example:
session("ArticleID") = DLookup("articles","max(article_id)","user_id=" &
Session("UserID"))

Hope you find this info useful.

Adam


"Frank Rocco" <farocco@hotmail.com> wrote in message
news:9iq01s$5i3$1@news.codecharge.com...
> Hi Jim,
>
> I don't think this would work well in a multi-user setting.
>
> What if user 1 has cust 100 up for insert
> and user 2 has cust 101 up for insert.
> Won't both users show the same user_num?
> If not please explain.
>
> Thanks
> Frank
>
>

Jim Ryan
Posted: 07/15/2001, 6:52 AM

Hi Frank,

Actually your right. There is a possibility of two people entering at the
same time. I'm using it for our company intranet for anyone to enter
engineering work orders. Since only 4 or 5 are issued a week, I figure the
chances are pretty slim of two users entering orders at the same time.
Watch, my luck I'll be adjusting this every time :-)

I also thought about locking the database while one is being entered but I
just wanted to get it working for now.

Jim




"Frank Rocco" <farocco@hotmail.com> wrote in message
news:9iq01s$5i3$1@news.codecharge.com...
> Hi Jim,
>
> I don't think this would work well in a multi-user setting.
>
> What if user 1 has cust 100 up for insert
> and user 2 has cust 101 up for insert.
> Won't both users show the same user_num?
> If not please explain.
>
> Thanks
> Frank
>
>

Jim Ryan
Posted: 07/15/2001, 9:14 AM

Ken,

I've been banging my head trying to figure this out. I really appreciate
your help. It works fine now. Many many thanks!

Jim



"Ken Hardwick" <kenhardwick@visto.com> wrote in message
news:9ipqbc$r2b$1@news.codecharge.com...
> Jim Ryan,
>
> Here is sql code that I just wrote this am to get the next available
> number...I am using this with Access..and could had used autonumber
> but may be moving my app to oracle so just wrote this instead...
>
>
>
> kenSQL = ""
> KenSQL = "SELECT max(user_num)+1 as NextNum"
> KenSQL = kenSQL + " FROM Prj_Names "
> kenRST = cn.execute(kenSQL)
>
> if isnull(kenRst("NextNum")) then
> fldUser_Num = "1"
> else
> fldUser_Num = kenRst("NextNum")
> end if
>
> set kenRSt = Nothing
>
> Just put this in your "before show event"
>
> Hope this helps....
>
> Ken Hardwick
> Norman,OK
>KenHardwick@visto.com
>
>
>
> Jim Ryan wrote in message <9ipg1o$8cq$1@news.codecharge.com>...
> >Hi All,
> >
> >I just downloaded and installed the latest version (Beta 4). Great job
> guys!
> >Anyhow, I created an entry form from a previous version (1.2) compiling
to
> >ASP and using MSAccess. Using the Autonumber feature in MSAccess, it
> >automatically assigns the next number to the main table and this is the
> >number I've been using to show the different records. Since you can't
show
> >the next number on the input form with MSAccess, (Believe me, I spent
hours
> >trying to use the DLookup function and the MAX() functions and had no
luck)
> >so I created a blank field called field1, with the Type set to listbox.
> >Under field properties | list, it is joined to another table called
> >nextnumber, with a primary key / id and showing / nextnum with only one
> >record in it. In the form properties under events | after insert, I put
> >coding in to update the nextnumber table, nextnum+1. Now when the user
> opens
> >the entry form the next number is now shown in a listbox with only one
> >number in it. (I know, it isn't pretty, but it works! ;-). When the user
> >clicks the add button, it adds the record to the main table and also
> updates
> >the nextnumber table to show the next number. Whew!. Ok, now the problem.
> >When I changed the field type to label and click on the field properties
|
> >join, and process the page, it doesn't show the next number. It only
works
> >with the listbox. I also tried changing the field type to textbox, but
> >unfortunately you don't get the join or list feature. That may be a good
> one
> >for the wish list! Any help would be appreciated.
> >
> >Jim
> >
> >
>
>

Jim Ryan
Posted: 07/20/2001, 3:55 AM

Well, it happened! I had one "bonehead" leave the record page open all day
while another entered a new one. Is there a way in CC to lock the database
while a user is entering a record? I would then refer another user that
wants to enter a record to a page that would say "The database is in use try
again later". Also, by locking the database, would others be prohibited from
viewing the other records? This would not be a problem if it did, this way
others can yell at the person if they leave it open all day. :-}

Jim


"Jim Ryan" <jryan@stratos.net> wrote in message
news:9is77q$4tl$1@news.codecharge.com...
> Hi Frank,
>
> Actually your right. There is a possibility of two people entering at the
> same time. I'm using it for our company intranet for anyone to enter
> engineering work orders. Since only 4 or 5 are issued a week, I figure the
> chances are pretty slim of two users entering orders at the same time.
> Watch, my luck I'll be adjusting this every time :-)
>
> I also thought about locking the database while one is being entered but I
> just wanted to get it working for now.
>
> Jim
>
>
>
>
> "Frank Rocco" <farocco@hotmail.com> wrote in message
>news:9iq01s$5i3$1@news.codecharge.com...
> > Hi Jim,
> >
> > I don't think this would work well in a multi-user setting.
> >
> > What if user 1 has cust 100 up for insert
> > and user 2 has cust 101 up for insert.
> > Won't both users show the same user_num?
> > If not please explain.
> >
> > Thanks
> > Frank
> >
> >
>
>


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.