473,322 Members | 1,480 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,322 software developers and data experts.

create function

64
Good day everbody..

Can anyone explain me, what was the function for the below code actually? Seems I'm still learning this Recordset, anyone can explain it for me what actually this code meaning?

Expand|Select|Wrap|Line Numbers
  1. Function Create(SupplierID As Long, EmployeeID As Long, OrderID As Long, PurchaseOrderID As Long) As Boolean
  2.     Dim rsw As New RecordsetWrapper
  3.     If rsw.OpenRecordset("Purchase Orders") Then
  4.         With rsw.Recordset
  5.             .AddNew
  6.             ![Supplier ID] = SupplierID
  7.             If EmployeeID > 0 Then
  8.                 ![Created By] = EmployeeID
  9.                 ![Creation Date] = Now()
  10.                 ![Submitted By] = EmployeeID
  11.                 ![Submitted Date] = Now()
  12.                 ![Status ID] = Submitted_PurchaseOrder
  13.             End If
  14.  
  15.             If OrderID > 0 Then
  16.                 ![Notes] = InsertString(PurchaseGeneratedBasedOnOrder, CStr(OrderID))
  17.             End If
  18.             If rsw.Update Then
  19.                 .Bookmark = .LastModified
  20.                 PurchaseOrderID = ![Purchase Order ID]
  21.                 Create = True
  22.             End If
  23.         End With
  24.     End If
  25. End Function
Mar 7 '16 #1
5 1432
Narender Sagar
189 100+
This code is for creating or updating Purchase orders.
Mar 7 '16 #2
mrijet
64
Thanks for replying...what does this codes mean..

Expand|Select|Wrap|Line Numbers
  1. ![Supplier ID] = SupplierID
What actually this symbol [!] for?
Mar 7 '16 #3
Narender Sagar
189 100+
This is the field in your form which is to be maintained, manually or logically. Like "Created By" will be filled by "EmployeeID"
Mar 7 '16 #4
jforbes
1,107 Expert 1GB
I think what is causing you confusion is the With Statement:
Office Version
Visual Basic Version

In the Code Sample, they are using the With Statement on a RecordSet The RecordSet Object supports a couple different ways to reference a Field and ! is one of them:
Expand|Select|Wrap|Line Numbers
  1. To refer to a Recordset object in a collection by its ordinal number or by its Name property setting, use any of the following syntax forms:
  2. Recordsets(0)
  3. Recordsets("name")
  4. Recordsets![name]
Mar 7 '16 #5
mrijet
64
Thanks for replying....

@jforbes means,
Expand|Select|Wrap|Line Numbers
  1. Recordsets("name")
  2. Recordsets![name]
was same meanings code?
Mar 8 '16 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: deko | last post by:
I have 3 files I need to write to - and need to make sure I have a lock on each, and take action if I can't get a lock. The code below works, but I know it could be more efficient if I used a...
5
by: Thomas LeBlanc | last post by:
I copied an example from the help: CREATE FUNCTION somefunc() RETURNS integer AS ' DECLARE quantity integer := 30; BEGIN RAISE NOTICE ''Quantity here is %'', quantity; -- Quantity here is 30...
1
by: Barbara Lindsey | last post by:
I am a postgres newbie. I am trying to create a trigger that will put a copy of a record into a backup table before update or delete. As I understand it, in order to do this I must have a...
5
by: Bob Stearns | last post by:
I don't understand the following error: DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned:...
1
by: Frank Neubert | last post by:
Hello! I work with "IBM DB 2 Universal Database for Windows NT" Version 6. I want to create Function, which are using in a Queries. I don't want to use external function. I want to create a...
13
by: invincible | last post by:
hi friends , how can I declare / create function during runtime similiar to lambda in lisp. thanks Mohan
4
by: Markus Bertheau | last post by:
Hi, why does everyone write CREATE FUNCTION foo() RETURNS INTEGER AS ' blah blah ' LANGUAGE 'plpgsql'; I've never seen for example:
2
by: Jiri Nemec | last post by:
Hello all, sorry about beginner question, but I'm sure function has correct structure, buw PostgreSQL reports error. (This function is only on approbation.) CREATE FUNCTION foo(int2) RETURNS...
0
by: bog39 | last post by:
We have z/os and DB/2 V. 8 running. I try to create a new UDF using the command CREATE FUNCTION: CREATE FUNCTION CNGETADR (INTEGER) RETURNS CHAR(50) EXTERNAL NAME CNADR001 ...
6
japuentem
by: japuentem | last post by:
throwing error when creating function DB21034E DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned:...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.