Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forms - Can I do form first before selecting from a browse? 1

Status
Not open for further replies.

rleiman

Programmer
May 3, 2006
258
US
Hi Everyone.

I am making a point of sale application and would like to know if I can have a form displayed and in that form call various browse windows to populate that form? This form will be used to create a sales receipt.

Is there anything special I need to be aware of?

I know it is not the normal Clarion way of interacting with the user but that is what the user wants.

Thanks.
Emad
 
Hi Emad,

Definitely. It is called a Window Procedure. Just populate then controls and define a SAVE button to do the needful. You can also use a Form procedure but set the GlobalRequest = InsertRecord in the topmost (first) embed of the WindowManager.Init method.

Regards
 
Hi ShankarJ,

I used a form procedure and set GlobalRequest = InsertRecord as you suggested. I can now see the insert message on the title bar.

Can you tell me how to initialize my autoincrement key field before the form is displayed since I did not call this form from a browse?

Thanks.
Emad
 
Hi Emad,

Look in the Help for FileManager.PrimeAutoInc & WindowManager.PrimeFields. So you can do a ThisWindow.PrimeFields and/or an Access:Table.PrimeAutoInc. Check the generated code of the form and if the PrimeFields is calling PrimeAutoInc then just call the PrimeFields method in WM.Init - after opening files.

Regards
 
Hi ShankarJ,

I will check them out.

Thanks.

Truly,
Emad
 
Hi Emad,

Check the FileManager.PrimeRecord method in the help as well.

Regards
 
Hi ShankarJ,

Thanks.

I will check them out.

Truly,
Emad
 
i do autoinc like this....
SRK is the shortcut of the table name
ID_RNK is the link between SRK table and RNK table...(not important for you)....i just copied my code, but you'll need to adjust it for yout needs.But i belive that you get the point. The key you want to autoinc. set on the very hihg value (something you will never reach...), PREVIOUS will find firs smaller value in the table...if there is no entry, previous will find zero, and that is error for previous function. then your key will be set to 1.Else it'll find for ex. 15, and do 15+1=16...end the value of your key in the new insert record will be 16.
Hope this helps!

Code is places 'Before Opening The Window'

IF ThisWindow.request = InsertRecord THEN
CLEAR(SRK:Record)
SRK:ID_RNK = RNK:ID_RNK
SRK:BR_SRK = 999999
SET(SRK:K_SRK,SRK:K_SRK)
PREVIOUS(STAVKA_K)
IF ERRORCODE() OR SRK:ID_RNK<>RNK:ID_RNK THEN
SRK# = 1
ELSE
SRK# = SRK:BR_SRK + 1
.
CLEAR(SRK:Record)
SRK:ID_RNK = RNK:ID_RNK
SRK:BR_SRK = SRK#
.
 
Hi!

A better way than assuming that values would not exceed 999999 would be to :

CLEAR(SRK:Record[red],1[/red]) ! clears the buffer to high values
SRK:ID_RNK = RNK:ID_RNK
SET(SRK:K_SRK,SRK:K_SRK)
PREVIOUS(STAVKA_K)

Regards
 
could you please explain a little better what exactly this code do: CLEAR(SRK:Record,1)

Thanx
 
Hi!

CLEAR() will clear the variable and it's elements (if it is a group) i.e. Strings to BLANK and numerics/dates/times to ZERO.

CLEAR(<>,1) will clear to high values i.e. the highest possible value that can be stored in the variables.

CLEAR(<>,-1) will clear to low values i.e. the lowest possible value that can be stored in the variables.

Please read the HELP for more information.

Regards
 
Hi ShankarJ,

I used your code as suggested like this and it worked great.

Code:
! Tell the form to go into insert mode.
!--------------------------------------
GlobalRequest = InsertRecord

Access:SalesHeader.PrimeAutoInc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top