Showing posts with label button. Show all posts
Showing posts with label button. Show all posts

Friday, March 30, 2012

please help me about build new table

please help me

i need for example

when my user clicke in the button a new table build in my sql database

please help me

Try the links below for more info on create table statement for SQL Server 2000/2005. Hope this helps.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_create2_8g9x.asp

http://msdn2.microsoft.com/en-us/library/ms174979.aspx

sql

Please Help Just Upsized Access To Sql And Now Code Doesnt Work

here is the code i was using from a command button which basically used the first and last name fields to make a primary key called chart number. now it doesnt work and i belive it is in the dim rs as dao.recordset statement because this data now resides on an sql server. here is the code snippet.

Public Function chartlookup()
Dim db As DAO.Database <--believe to be the problem
Dim rs As DAO.Recordset <-- belive to be the problem
Dim SQL As String
Dim NewNum As Integer
Dim NeWChartNum As String

SQL = "Select max(Cint(Right([chartnumber],6))) As RecNum From tblpatientinfo WHERE UCase(Left([chartnumber],5)) = '" & UCase(Left([Forms]![fpatient]![lname], 3)) & UCase(Left([Forms]![fpatient]![fname], 2)) & "'"

Set db = CurrentDb() <-- -problem
Set rs = db.OpenRecordset(SQL) <--problem

If IsNull([Forms]![fpatient]![chartnumber]) = False Then GoTo 400

If rs.EOF = False Then
If IsNull(rs!RecNum) = False Then
NewNum = rs!RecNum + 1
Else
NewNum = 1
End If
End If
'If NewNum = 1 Then

[Forms]![fpatient]![chartnumber] = UCase(Left([Forms]![fpatient]![lname], 3)) & UCase(Left([Forms]![fpatient]![fname], 2)) & Format(NewNum, "000000")
'End If

400 End Function

basically if you typw in john smith this code would put smijo00001 into chartnumber field now i get a run-time error 91.What error are you receiving?

Also be advised that UCase is not supported in MS SQL, you should use UPPER, nor is Cint.

You have a few access specific casts there that are going to cause trouble for you.|||Change you dao to ado - using recordset and/or connection objects.|||Originally posted by Teddy
What error are you receiving?

Also be advised that UCase is not supported in MS SQL, you should use UPPER, nor is Cint.

You have a few access specific casts there that are going to cause trouble for you.

im receiving a run-time error 91 in the set rs= db.recordset(sql) statement but i know it coming from previous dim db as dao.database and dim rs as dao.recordset. i dont know how to convert this vb code to work with sql. maybe dim rs as sql.recordset and dim db as sql.database . please forgive my ignorance but i am new to sql and i dont know the syntax for sql. by the way thank you for the advice with ucase and cint not working . i tried a previous suggestion and turned dim rs as ado.recordset but the only option i get is adobe.recordset am i missing a reference .|||You need to use the ms ado 2.x library reference. Using adodb.recordset and adodb.connection - however, in your case you only need adodb.recordset.|||Hey
Who one saying that ODBC Connections not possible by DAO?

[QUOTE][SIZE=1]Originally posted by opcbriley
here is the code i was using from a command button which basically used the first and last name fields to make a primary key called chart number. now it doesnt work and i belive it is in the dim rs as dao.recordset statement because this data now resides on an sql server. here is the code snippet.

Public Function chartlookup()
Dim wrkODBC As Workspace
Dim conPubs As Connection
Dim rs As DAO.Recordset <-- belive to be the problem
Dim SQL As String
Dim NewNum As Integer
Dim NeWChartNum As String

SQL = "Select max(Cint(Right([chartnumber],6))) As RecNum From tblpatientinfo WHERE UCase(Left([chartnumber],5)) = '" & UCase(Left([Forms]![fpatient]![lname], 3)) & UCase(Left([Forms]![fpatient]![fname], 2)) & "'"

Set wrkODBC = CreateWorkspace("NewODBCWorkspace", "admin", "", dbUseODBC)
Set conPubs = wrkODBC.OpenConnection("costing", dbDriverNoPrompt)
.........

You may also open connection by using this code
remaining code will remain same
plz use it n reply me
thx|||You can use odbc - but don't - you are much better off using oledb (or use tds in .net). Better performance, resource usage and flexibility/functionality.|||yeah i know that OLEDB performance much better that dao but person asked abt DAO libraray n no one was there to reply by DAO libraray so I hv ginven reply by DAO library|||i appreciate all your help i was able to switch to ado connection i finally learned the syntax last night after about hour of reading. that code is working perfect now.

now on to find all my other problems that i have to change to be compatible with sql. i sure hope sql is worth all this trouble.

Friday, March 9, 2012

PL/SQL for searching

hi all..

i'm a beginner in using oracle9i form for web dev and ..i have problem to create searching button (pl/sql code) where the record that i tried to find using the text item..can somebody help me

example:
textitem10 is value that will be keyin in the form
----
declare
textitem10 number(2);

begin
select empno,ename,edept from emp
into :textitem1,
:textitem2,
:textitem3
where empno = 'textitem10'
end;
execute_query;

but my coding is doesn't work..
found error "FRM-40735: WHEN-BUTTON-PRESSED trigger araised unhandled exception ORA-01403"..any body know help me..pleaze
thanks
flyguysOriginally posted by flyguys
hi all..

i'm a beginner in using oracle9i form for web dev and ..i have problem to create searching button (pl/sql code) where the record that i tried to find using the text item..can somebody help me

example:
textitem10 is value that will be keyin in the form
----
declare
textitem10 number(2);

begin
select empno,ename,edept from emp
into :textitem1,
:textitem2,
:textitem3
where empno = 'textitem10'
end;
execute_query;

but my coding is doesn't work..
found error "FRM-40735: WHEN-BUTTON-PRESSED trigger araised unhandled exception ORA-01403"..any body know help me..pleaze
thanks
flyguys
ORA-01403 means "No data found" - i.e. the select returned no rows.

This is probably because you should have written it like this:

select empno,ename,edept from emp
into :textitem1, :textitem2, :textitem3
where empno = :textitem10;

As written, it was looking for an emp record with an empno value of 'textitem10', which of course does not exist.