Search This Blog

Determining First Character

If you wwould like to determine the first character or first three characters etc of your textbox, you can use below foxpro codes:

THISFORM.Text1.VALUE = LEFT(TRANS(THISFORM.Text2.Value),1)

Delete Data in a Table Code

Deleting data from the local table.

SET EXCLUSIVE ON
USE "C:\EMPLOYEE\DATA\EmployeeList"
DELETE ALL
PACK

Day Month Year Code

THISFORM.TEXT1.VALUE = DAY(DATE())
THISFORM.TEXT2.VALUE = CMONTH(DATE())
THISFORM.TEXT3.VALUE = YEAR(DATE())

Main Program

SET CLASSLIB TO C:\GenLed\Classlib\frame
SET CLASSLIB TO C:\GenLed\Classlib\basectrl ADDITIVE
SET CLASSLIB TO C:\GenLed\Classlib\DeBrief
_screen.picture = "C:\GenLed\Images\background.bmp"

SET CENTURY ON
SET CENTURY TO 19 ROLLOVER 60
SET EXCLUSIVE OFF

RUN NumToWords

DO FORM "C:\GenLed\Forms\Login"

ON SHUTDOWN QUIT
MainApp = CREATEOBJECT("DEBRIEF", "FMLFC GENLED - Accounting Systematic Tool")
MainApp.ReadEvents()

SET CLASSLIB TO
RETURN

Log Out Code

PUBLIC pCurrUser
SELECT SviewAccess
=REQUERY("SviewAccess")
LOCATE FOR ALLTRIM(UserName) = ALLTRIM(pCurrUser)
IF FOUND()
REPLACE AccessStatus WITH "LOGOUT"
THISFORM.REFRESH
ENDIF

CLEAR EVENTS
ON ShutDown
QUIT

Journal Entries on Journal Form

Upon clicking the grid a new form will appear where you can add information. It will also retain information from previous form such as Journal Number, Reference Documents and Particular.

PUBLIC pJournalNo, pJeNum, pRefDocu, pPart
IF !EMPTY(THISFORM.Text5.VALUE)
IF !EMPTY(THISFORM.Text7.VALUE)
THISFORM.Cs_Branches()
pJournalNo = THISFORM.Text5.VALUE
pJeNum = INT(THISFORM.Text7.VALUE)
pRefDocu = THISFORM.Text8.VALUE
pPart = THISFORM.Text1.VALUE
DO FORM "C:\GenLed\Forms\JournalForm"
ELSE
pJournalNo = THISFORM.Text5.VALUE
pRefDocu = THISFORM.Text8.VALUE
pPart = THISFORM.Text1.VALUE
pJeNum = ""
DO FORM "C:\GenLed\Forms\JournalForm"
ENDIF
ELSE
=MESSAGEBOX("Select a Journal Number", "Confirmation")
ENDIF
THISFORM.Grid1.Refresh

SQL Connections

Using SQL Server, you will need a connection string to be able to access the database. Here is the basic connection string format.

DRIVER=sql server;SERVER=ServerName;UID=UserName;PWD=Password;APP=Microsoft Visual;WSID=PcName;DATABASE=DatabaseName

Do not forget to verify connection.