Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Trouble Creating Query For A Report To Pull Info I Need From 2 Tables

I am working on a payroll application. I am trying to generate reports and I'm having trouble creating a query to pull the info I need for one report.I have all employees in a Master table. One of the fields is the Paycode which tells if an employee is Hourly or Salary.The payroll hours are entered into another EmployeeHours table.In my report I need to print all the Paycode 2(Salary) people (which is no problem) as Normal Salary unless hours have been entered for them (here is the problem), for this I need the information from the EmployeeHours table (records are not output for Salary people unless they have a change in Normal Salary), and I only want the employee printed once, either as Normal Salary or with the inputted hours.I can not figure out how to create a query pulling all Paycode 2 people, with and without(again, records are not output for Salary people unless they have a change in Normal Salary)hours together.Ex:Emp#.......Reg Hrs1..........Normal Salary (Would be pulled from Master as a Salary Person)2..........42.00 (would be pulled from EmployHours as a change in normal)3..........Normal Salary4..........Normal Salary5..........48.00 etcI need to create a general query in the Access database to create the report, then in my code I want to sort it in the order the user wants (Alpha, Numeric etc).At least this is how I have done the other reportsHope this made at least a little sense. Thanks in advance for any helpCatrina

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Trouble Creating A Query To Pull The Info I Need
I am working on a payroll application. I am trying to generate reports and I'm having trouble creating a query to pull the info I need for one report.

I have all employees in a Master table. One of the fields is the Paycode which tells if an employee is Hourly or Salary.

The payroll hours are entered into another EmployeeHours table.

In my report I need to print all the Paycode 2(Salary) people (which is no problem) as Normal Salary unless hours have been entered for them (here is the problem), for this I need the information from the EmployeeHours table (records are not output for Salary people unless they have a change in Normal Salary), and I only want the employee printed once, either as Normal Salary or with the inputted hours.

I can not figure out how to create a query pulling all Paycode 2 people, with and without(again, records are not output for Salary people unless they have a change in Normal Salary)hours together.

Emp#.......Reg Hrs

1..........Normal Salary (Would be pulled from Master as a Salary Person)
2..........42.00 (would be pulled from EmployHours as a change in normal)
3..........Normal Salary
4..........Normal Salary


I need to create a general query in the Access database to create the report, then in my code I want to sort it in the order the user wants (Alpha, Numeric etc).

At least this is how I have done the other reports

Hope this made at least a little sense. Thanks in advance for any help


Access Query Not Recognizing Info In Tables

1.) i have created a program (PackingSlip.mdb, just for laughs) in access 2000 that allows me to import text comma delimited, quote bound text files and create packing slips, before the necessary information is sent to our shipping system. the program has not gotten heavy use yet, but the limited action it has seen, it has been successful 100% of the time.

2.) at the behest of one of our clients, i created another access 2000 program (export.mdb, for a couple more laughs) that she could use to create the file from a fixed width file that is created by her system. it involves using the import file wizard with some pre-set "specs". the end result is a comma delimited, quote bound text file with the correct number of fields.


when i import the file created by export.mdb into PackingSlip.mdb, everything appears fine. however, when i open the query that sends all pertinent information to my various packing slips, there is nothing in it. when i check the tables where the query is getting it's information from, they have all of the correct data in them. i would post code here, but i have no idea where to start.



Creating A Report From 3 Tables
I have 3 inventory tables: Computer, Server and Printer. each tables primary key is a autonumber

I have 3 data reports that list the inventory in each that use a SQL query to do it. such as

Select ProductType, ProductName, UnitsInStock FROM ComputerInventory ORDER BY ProductType

Is there a way to create a report that can combine all those and list the inventory in all 3 tables, in essence a total inventory report? i'm not too keen on the data environment and reports but i'm just wondering if its possible. i'm not sure if i really need it but if its doable it might be nice to have


Pull Info From Text
I have two problems and I'll try to explain as best as I can...

1) I need my program to 'Search' through a text file for certain information that a user types in. The text file's data is broken down into each line (as so):

"Billy", 16, "California"
"Susie", 17, "New York"
"Jack", 14, "California"

I have 8 different Text files with there own major catogory and when the user types in a specific 'Name' or 'State' I want the program to search through each text file and display the matches (Text File Number and the Person's name only) in a listbox.
(i.e. User types california under state and it should only display
01 Billy
01 Jack

2) After Displaying the names, the user can click on the name in the listbox and click a cmd button and open a new form displaying all the info on the line that matches that name. (clicks on 01 billy and distplays 17 new york in a new form) I want this also to be a achieved by looking for the number first, open that file number and Searching through that one text file to pull all the info from that line.

Hope I Explained well...

Edited by - sonic86 on 9/29/2003 5:13:11 AM

Pull Info From Stored Procedure

I have a stored procedure in SQL Server.. I am using VB as my front end.  I am trying to extract information that comes from a stored procedure that exists in the database.  I cannot make changes to this SP.  However, the SP is made so that it executes a select statement at the end of it.  

I am trying to figure out how I can extract the data from the select statement in VB, concatenate a few fields and push into a new table in the DB?

I managed to see the data in vb using debug.print, however have not figured a way to get all columns and then push the rows of data into a new table?

Where do I start with this??? any help is greatly appreciated!

Thanks in advance!


How Do I Pull Out Data From Tables In An RTF File?

I am currently using a database to hold information and convert it to an RTF file to use with Visual Basic. The RTF file has tables that display information I need. I am trying to get only a couple rows out of the tables and display it in a user interface I made. I cant search for specific text because the data could change and I wont know what exact text to look for. Also, the table wont be on the same line every time I convert the RTF files from the database files. Could you point me in the right direction of what I should do and what functions I should be using.


Pull Info From My Access Database....into Word?
I have a letter that has been created in word, I also have a database of names and info. If I select a person from the database how can I get like the persons names to insert into the Letter I have written in word?
I hope this makes sense and someone can run me through how to do this? thanks!

Pull Info From Access Database Into Text Boxes
I have an Access Database with 3 tables: Customer, Software, Computer.
I have linked the VB 6.0 Form to this database with a data control as well as linked the text boxes to the correct fields in the linked tables in the Access database. I have a command button that I would like to activate a search of the database which will fill in the text box fields on the form with the information from the database when it finds it.
Example: I enter a customers social security number in a text box and click the search button; It should then automatically search the databse and fill in the customers name, address, phone number, etc in each seperate text box. Can you please provide me with the code/commands that I need to do this?

This is going to be used to track the software products that a customer has on his current machine. One potential problem that I anticipate having is when I search for a customer and all his info comes up including his pc information and software loaded on it......If the machine has more than one piece of software, how will the search find it?

It is my hope that I will have most all of the information in all 3 tables linked to the record I am searching for to fill in the text boxes I have created when I perform this search.

How To Dynamically Change The Login Info Of A Crystal Report Using Crystal Query File

How can I dynamically change the login information of a Crystal Report that uses a Crystal Query File (*.qry) to retreivee it's data using VB.NET?

It works fine when the report is built on regular table links generated within the Report Designer, I simply use the following :

Dim myLogonInfo As New CrystalDecisions.Shared.TableLogOnInfo()
myLogonInfo.ConnectionInfo.ServerName = UCase(SelectedDB.GetName) & "_ODBC"
myLogonInfo.ConnectionInfo.DatabaseName = UCase(SelectedDB.GetName)
myLogonInfo.ConnectionInfo.UserID = UCase(usr)
myLogonInfo.ConnectionInfo.Password = UCase(pwd)



But when the Data is retreive using a query file it crashes.
Any ideas?


Creating A &"Data&" Report From Multiple Tables

I need to start creating data reports which extract data from over four different tables and produce an invoice as a result.

I've been considering extracting all the neccessary information and then entering this into record in a "invoices" table, while this does duplicate data it would allow for invoices to be reprinted easily.

Is this a bad idea? Would it be better to attempt to write a query using the dataenvironment which extracts from four plus tables?

I like the option of reprinting invoices when neccessary.


Pull Down Combo Box By Clicking In Text Area Istead Of Pull-down Arow
I was wanting to just click on the text area of the combo box to similate clicking on the pull down arrow.

combo1 is the name of the combo box.

Urgent: Pull A Report In Excel From Visual Basic
hi everybody
i am writing code in Visual basic to pull out a report in Excel but when the report is being launched, some rows are being disappeared, like :
row 1 Name Age Position
row 2 John 23 Analsyt
row 3 Mili 25 Analyst
row 5 Paul 30 Manager

In row 4, there was supposed to be another name, but I dnt kno how its disappearing, in fact wen im running it debug mode, everything is being pulled out
plz help

How To Join 6 Tables And Have 2 Tables Query 1 For Same Field??
Sorry that subject isn't clearer but it's kind of strange what I'm trying to do. I have a database table named "tblJob". This table (which gets updated a LOT) holds secondary keys (I think that's what they're called) of the primary keys of other tables. Here's the layout.

jobID (auto-number)
custID (number -- from tblCustomer)
empID (number -- from tblEmployee)
locID (number -- from tblLocation)
homeID (number -- from tblHomeArea)
jobStatus (text)

custID (auto-number)
custFName (text)
custLName (text)

locID (auto-number)
locAddr1 (text)
cityID (number -- from tblCity)

homeID (auto-number)
homeAddr1 (text)
homeAddr2 (text)
cityID (number -- from tblCity)

cityID (auto-number)
cityName (text)

empID (auto-number)
empName (text)
empUnitName (text)

Basically I want to query all the records from tblJob WHERE the jobStatus = 'Employee Assigned'. But I'm outputting all of the results into a datagrid in the form so that that the user can clearly see which employee is working with which customer, where (street and city), the customers name, etc.

Anyway, here is the query that I've written which SOMEWHAT works:


SELECT    tblJob.jobID, tblJob.custID, tblJob.empID, tblJob.locID, tblJob.homeID, tblJob.jobStatus,
    tblLocation.locID, tblLocation.locAddr1, tblLocation.cityID,
    tblHomeArea.homeID, tblHomeArea.homeAddr1, tblHomeArea.cityID,
    tblCustomer.custID, tblCustomer.custFName, tblCustomer.custLName,
    tblEmployee.empID, tblEmployee.empUnitName,
    tblCity.cityID, tblCity.cityName

FROM    (((tblJob INNER JOIN tblLocation ON tblJob.locID = tblLocation.locID)
    INNER JOIN tblHomeArea ON tblJob.homeID = tblHomeArea.homeID)
    INNER JOIN tblCustomer ON tblJob.custID = tblCustomer.custID)
    INNER JOIN tblEmployee ON tblJob.empID = tblEmployee.empID

WHERE    tblJob.jobStatus='Assigned'

This code (which I've cleaned up using a text editor for purposes of this post) is being put into the ADODC.Recordsource field. When I run it in Access 2000 (as a query), I get a pop-up box that asks for "tblCity.cityID" and "tblCity.cityName". When I run it in VB 6.0, I get this error:

Quote:No value given for one or more required parameters

I'm pretty sure the problem is that I'm referencing the cityName field in my select but I'm not making that part of my INNER JOIN code.

Here's my problem. How do I run a query (is it another JOIN or a sub-query???) to get the cityName from tblCity where the tblCity.cityID matches tblLocation.cityID AND
get the cityname from tblCity where the tblCity.cityID matches tblHomeArea.cityID?

I've tried just adding in additional inner joins but none of that is working.

Any help with this would be greatly appreciated. I thought I had read somewhere that sub-queries are slower than JOINS but I am so new to JOINS that I can't figure this out and sub-queries are something I've never even touched.

Thank you in advance for any help you can give me.


Edited by - DTFan on 8/22/2003 10:11:30 AM

Crystal Reports & Dynamic Query (even Tables And Fields Changes In The Query At Run Time)
Hi there!

I need to link the crystal report to a query that is generated dynamically. I will be knowing about which table to be linked and which fields to be retrieved at run time only. Fields are refered using an alias in all the query output to get a common name for all. I cant use a dataset or TFX file solution as mentioned earlier as i am not aware of the tables and fiels till runtime. Else i have to hardcode all the possible combinations in different tft file and link .

i tried with a temporarytable but that too doesnt seems to work.

Can anyone guide me of any simpler methode of doing this?


Trouble Linking Tables In VBA
To whomever can help me overcome this problem I would greatly appreciate your advice

This question does not refer to SQL or .NET but I'm hoping someone can help me. It refers to Visual Basic for Applications. (yes, I am a novice to VBA)

I have a Master table in MS Access that generates sequential numbers (increments by 1) to identify a client as a unique record and will not duplicate numbers or records.

I have over 40 other Smaller tables that I want to link to the Master table. Access does not allow the developer to link more than 32 tables to the Master table using the wizards. And, the total number of Smaller tables is likely to grow in number. These Smaller tables do not have anything to do with each other. They are totally independent from each other except for the fact that each Smaller table must be linked to the Master table.

Unlike the Master table, the Smaller tables can have duplicate numbers. Please see below:

Master table


Smaller tables


If you have any idea how I can link these Smaller tables to the Master table please reply to this question. This problem is really holding me up from developing subsequent code.

Thank you kindly,
Denise Lenora

Database Tables Trouble....
I have a problem with a table of my database.

Here's what the tables look like




Now, obviously, I want it so that I can have it so that I can call the dishes from their DISH_ID and TYPES_CODE joint. EG, chicken dish 1 will be 'CHI001', where CHI part is from the types table, and 001 is from the dish table.

That is alright, but the problem comes in when I add a fish dish. Since it's the first fish dish, I want to call it FSH001. But since Dish_ID is the primary key in the DISH table, I can't have 2 instances of 001 regardless of how different the TYPES_CODE is...

I've been thinking of modifying the program to produce a joint key where the joining of DISH_ID and TYPES_CODE will produce the primary key. However, I don't know how to do this in VB code... can somebody please help?


More Trouble With MS Word Tables
Thanks to sotoasty, I have got my code (which i show below) creating the table I need in Word and filling cells with data. Now then, let's say I exit Word but leave my program still running. I hit my report button again to make Word come back up with the table and all, but i get this error instead...

Method "Add" of "Tables" Failed.

I only get this error after the program has launched Word once already, and I ONLY get it if this table is involved. I tried removing the line of code below (which draws the table) and I was able to run Word over and over without this error. Any ideas?

wrdapp.Selection.Tables.Add Range:=Selection.Range, NumRows:=31, NumColumns:=5,DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:=wdAutoFitFixed

Need Info From Two Tables
I have the following select statement which works, I need help to adapt it

adobau.RecordSource = "SELECT * FROM Liegenschaften INNER JOIN tblbau ON Liegenschaften.Rimo_Liegnr = tblbau.Liegenschaft"

my adobau.recordset loops through Liegenschaften and gives me all the info of Liegenschaften that has match in tblbau, but I want some info from tblbau also, how would I do this?

Fetch Info From Two Tables
I have two Access 2003 tables:


1 2 3 ABC
2 2 1 EREER
3 1 3 OIUOI
4 3 3 PERE
5 2 2 DFE

1 Joe Smith
2 Cal Jones
3 Bill Carson
I would like to get this output if I query for a MID number such as 3:
Firstname Lastname Firstname2 Lastname2 Info
Joe Smith Bill Carson OIUOI
My attempt below only fetches one name and ignores the TE value.

select * from TablePerson INNER JOIN TableMain on
TablePerson.PID = TableMain.PO
where TableMain.MID = 3

Another example if I query for MID number 5 I should get this:
Firstname Lastname Firstname2 Lastname2 Info
Cal Jones Cal Jones DFE

Please advise

Trouble Updating MS Access Table When Reading Two Tables
Below is my SQL statement. I am reading two tables, but would like to update just one. I don't think MS Access allows this as I am receiving a database lock error. How do you go about updating a field when you are reading data from more than one table?

For I = 1 To ListDoc(0).ListItems.count

If ListDoc(0).ListItems.Item(I).Selected = True Then
gKid = CLng(Trim(Mid(Mainfrm.ListDoc(0).ListItems.Item(I).SubItems(3), 1, 10)))
End If

TempSQL$ = "SELECT T980_REPORT_ID.A2_RPT_ID, T980_DD350.A3B_PURCH_OFC_ID FROM T980_REPORT_ID, T980_DD350 WHERE T980_DD350.K_ID = " & gKid & " AND T980_REPORT_ID.K_ID = T980_DD350.K_ID"
Set TempDyna = MyDb.OpenRecordset(TempSQL, dbOpenDynaset)
DBEngine.Idle dbFreeLocks

If TempDyna.RecordCount = 0 Then
Call dfClose(TempDyna) 'phm changed 11/9/01
Exit Sub
End If

If TempDyna("A2_RPT_ID") = "" Or IsNull(TempDyna("A2_RPT_ID")) Then
If Len(TempDyna("A3B_PURCH_OFC_ID")) = 4 Then
TempDyna.LockEdits = False
TempDyna("A2_RPT_ID") = "0001"
TempDyna.LockEdits = False
TempDyna("T980_REPORT_ID.A2_RPT_ID") = "00001"

End If

If Len(TempDyna("T980_DD350.A3B_PURCH_OFC_ID")) = 4 Then
TempDyna.LockEdits = False
TempDyna("T980_REPORT_ID.A2_RPT_ID") = TempDyna("T980_REPORT_ID.A2_RPT_ID") + "0001" 'Air Force
TempDyna.LockEdits = False
TempDyna("T980_REPORT_ID.A2_RPT_ID") = TempDyna("T980_REPORT_ID.A2_RPT_ID") + "00001" 'Navy
End If

End If

Next I

Call dfClose(TempDyna)

Unable To Display Info From Another Tables
Hi all ...

I had tried to display info from another table in the detail section of the datareport.

But everytime, it will return me error stating "Datafield 'po.itemno' not found."

My coding stated below:

sql = "select pr_info.po_no, pr_info.po_req_date, " & _
"pr_info.po_requestor, pr_info.po_req_dept, " & _
"pr_info.po_req_callcentre, pr_info.po_top, " & _
"item_info.itemno, item_info.itemdesc, item_info.itemqty, " & _
"item_info.itemprice, item_info.itemamt " & _
" from pr_info LEFT outer join item_info on pr_info.po_no = item_info.ItemPONo " & _
"where pr_info.po_no = '" & lblPR_No.Caption & "'"

DataEnvironment1.Commands!Item_Info.CommandText = preshape & sql & _
" order by pr_info.po_no, item_info.itemno} AS pr_info COMPUTE pr_info, " & _
"ANY (pr_info.'po_no') as po_no, " & _
"ANY (pr_info.'po_requestor') as Requestor, " & _
"ANY (pr_info.'po_req_date') as ReqDate, " & _
"ANY (pr_info.'po_req_dept') as ReqDept, " & _
"ANY (pr_info.'po_req_callcentre') as ReqCC, " & _
"ANY (pr_info.'po_top') as TOP " & _
"By 'po_no'"

dataRptPRS.Caption = "Purchase Order for " & txtPR_SupName.Text
If DataEnvironment1.rsItem_Info.State = adStateOpen Then
End If


quite urgent.. Would appreciate all the help.


Retrieving Info From Related Tables
Newbie question for the experts out there...

I have an Access .mdb with mulitple tables, all related by a unique key.
I need to populate some VBA userforms with info from various tables and was wondering what the best way was to do this.
Should I be opening and closing recordsets to access the different tables?

TIA, Joni

Trouble Finding Duplicate Data Accross Multiple Tables
Hi all,

Im having trouble trying to create a VB query in Access XP to locate duplicate data accross 2 tables, then to allow a user to adjust the incomming data to a new value, (recording the old value in the old pack number location.


Table 1 Pack No

Table 2 Incomming pack no, Old pack number

if anyone could shed some light on it'd be a huge help

Thanks all


Fill Datagrid With 1 Sql Statement With Info From 2 Tables
Here is the situation.

I have
TABLE1 with field Field1, Field2
TABLE2 with field FieldA, FieldB

I want to make a select in both tables to fill a datagrid. The datagrid will have 2 column: Status and Nb

In column Status i want values of field ( Field1 and FieldA ) which contains same type of value both in 2 different tables.
In column Nb i want a count of field ( Field2 and FieldB ) ........

Separately it would be

How to get the same result but in only 1 sql statement ? hope its clear enough

Edited by - Shandy on 4/22/2004 8:58:28 PM

Inserting Info From 2 Tables And New Datas Collected On A Form
Hi, got a problem with my sql statement, I need to retrieve information from table "employee" and table "empcode" and insert them into a table called "empexit" together with information collected from a form.

The table "empexit" fields --> xempno,xdcode,xlyyyyxlmm,xldd (this part i need to retrieve from tbl employee)

xrsn01,xrsn02,xrsn03 -->(need to retrieve from tbl Empcode)

(XIND1Y,XIND1N,XIND2Y,XIND2N,XIND3Y,XIND3N,XINDRK,XWK11,XWK12,XWK13,XWK2A1,XWK2A2,XWK2A3,XWK2B1,XWK2 B2,XWK2B3,XWK2C1,XWK2C2,XWK2C3,XWK3A1,XWK3A2,XWK3A3,XWK3B1,XWK3B2,XWK3B3,XWK41,XWK42,XWK43,XWK51,XWK 52,XWK53,XWK61,XWK62,XWK63,XWK71,XWK72,XWK73,XWK81,XWK82,XWK83,XWK91,XWK92,XWK93,XCOM1,XCOM2,XCOM3,X COMT) --> new information collected from the form

I will attach my project later. But if anyone can help me now with the little information i provided it would be great. thanks

My current sql looks like -->

(This is only for inserting the new data collected from the new forms.)
"VALUES(" & optQ1yes.Value & ",'" & optQ1no.Value & "','" & optQ2yes.Value & "'" & _
",'" & optQ2no.Value & "','" & optQ3yes.Value & "','" & optQ3no.Value & "'" & _
",'" & txtInduction.Text & "','" & optCol1.Value & "','" & optCol2.Value & "'" & _
",'" & optCol3.Value & "','" & optCM1.Value & "','" & optCM2.Value & "'" & _
",'" & optCM3.Value & "','" & optFSE1.Value & "','" & optFSE2.Value & "'" & _
",'" & optFSE3.Value & "','" & optSM1.Value & "','" & optSM2.Value & "'" & _
",'" & optSM3.Value & "','" & optTE1.Value & "','" & optTE2.Value & "'" & _
",'" & optTE3.Value & "','" & optTM1.Value & "','" & optTM2.Value & "'" & _
",'" & optTM3.Value & "','" & optSal1.Value & "','" & optSal2.Value & "'" & _
",'" & optSal3.Value & "','" & optCom1.Value & "','" & optCom2.Value & "'" & _
",'" & optCom3.Value & "','" & optBen1.Value & "','" & optBen2.Value & "'" & _
",'" & optBen3.Value & "','" & optTS1.Value & "','" & optTS2.Value & "'" & _
",'" & optTS3.Value & "','" & optWE1.Value & "','" & optWE2.Value & "'" & _
",'" & optWE3.Value & "','" & optJS1.Value & "','" & optJS2.Value & "'" & _
",'" & optJS3.Value & "','" & txtComp1.Text & "','" & txtComp2.Text & "'" & _
",'" & txtComp3.Text & "','" & txtAddCom.Text & "')"

Trouble Creating EXE
I'm trying to create an EXE from a VB Project. The project compiles fine, but when I try to create the EXE it gets half way throught the "Writing EXE" bit and then crashes out of VB. The EXE is unfinished, and there are loads of .OBJ files in the directory that the EXE should be in. I don't get any error messages - just that VB is suddenly no longer open.

I've tried the usual - switch off, switch on - and it doesn't help. I can't test easily run it elsewhere as it needs a scanner and we only have one PC around here with both VB and a scanner.

Anyone got any ideas?

Query Trouble
How would i do a query that wants to select too tables and match the data?

query = "SELECT * FROM [songs] WHERE [Artist] = '" & artistname & "' and where [ID] = " & r & ""

Is that the correct syntax?

Query Trouble
Hello, I am connecting to a Micros sybase database.
I have been able to connect with a simple query like:

Private Sub Command1_Click()
Dim wrkJet As Workspace
Dim MyDB As Database
Dim MyDBSyb As Database
Dim rs As DAO.Recordset
Dim rs2 As Recordset
Dim rs1 As Recordset
Dim rs3 As Recordset
Dim RS4 As Recordset

Set wrkJet = CreateWorkspace("", "admin", "")
Set MyDBSyb = wrkJet.OpenDatabase("micros", dbDriverNoPrompt, False, _

strsql = "SELECT * from emp_def inner join time_card_dtl on emp_def.emp_seq = time_card_dtl.emp_seq "

Set rs1 = MyDBSyb.OpenRecordset(strsql)

End Sub

Now I have (with a lot of help) built a query in sybase central that works and returns the data I am looking for.
The query is very large and I am not able to get it into VB

I am not sure where to even start but here is what I created that does work from sybase central:

SELECT tc.employee_number, tc.emp_seq, tc.last_name, tc.first_name, tc.time_card_seq, tc.job_number, tc.job_name,
tc.clock_in_datetime, tc.clock_out_datetime, tc.default_regular_rate, tc.override_regular_rate,
sales.shift_number, sales.start_time, sales.End_time, sales.gross_rcpts_ttl, sales.chgd_tips_ttl, sales.tips_decl_ttl
FROM "micros"."v_R_employee_time_card" as tc,
"micros"."v_R_employee_sales_tips" as sales
Where tc.emp_seq = sales.emp_seq
and tc.clock_out_datetime > sales.start_time
and (tc.clock_out_datetime < sales.End_time or sales.end_time is Null)
and tc.emp_seq = 662
SELECT tc.employee_number, tc.emp_seq, tc.last_name, tc.first_name, tc.time_card_seq, tc.job_number, tc.job_name,
tc.clock_in_datetime, tc.clock_out_datetime, tc.default_regular_rate, tc.override_regular_rate,
0, '1970-01-01 00:00:00.000', '1970-01-01 00:00:00.000', 0, 0, 0
FROM "micros"."v_R_employee_time_card" as tc
Where not exists (select * from "micros"."v_R_employee_sales_tips" as sales Where tc.emp_seq = sales.emp_seq
and tc.clock_out_datetime > sales.start_time
and (tc.clock_out_datetime < sales.End_time or sales.end_time is Null))
and tc.emp_seq = 662
order by 2, 5

vb doesn't seem to like the quotes in these lines:


and in general I am not sure how to break it up to properly format it into a string.......

any help will be greatly appreciated....


Data Report : Adding An Info Into To The Report..
How do I add a value I wanted to any section in the data report during runtime of the program such as the Staff code that print the report ? The data report only allow me to add in fields of a table in a DataEnvironment only.

I'm Having Trouble Creating Type's In VBA
I made a type "Employee" in a class module.


Option Compare Database

Option Explicit

Private Type Employee
DateHired As Date
FullName As String
IsMarried As Boolean
HourlySalary As Currency
End Type

Then I'm trying to assign a variable as this new user defined type
in a sub function.


Private Sub cmdCreate_Click()
Dim Contracter As Employee

Contracter.DateHired = #12/4/2004#
Contracter.FullName = "James McNeil"
Contracter.IsMarried = False
Contracter.HourlySalary = 10

txtDateHired = Contracter.DateHired
txtFullName = Contracter.FullName
chkIsMarried.Value = Contracter.IsMarried
txtHourlySalary = Contracter.HourlySalary

End Sub

but an error saying " method or data member not found" keeps popping up for the .datehired

any suggestions?

Trouble Creating Recordsets
I think i need to activate a rference library, but maybe it's more than than:

dim rs as adodb.recorset "Employees", cn, adOpendynamic, adLockOptimistic, adCmdTable

**at this point when i start typing ad..itellisense doesn't give me options for any of these, anyone know why?

also i call another private sub that should populate text boxes:

txtEmpName.text=rs.Fields.Item("Employee Name")

**Now at this point itellisense is doing its thing until =rs.Fields in which point it won't show anything.

Is there a reference library that needs to be activated or is should is this all part of the active x controls and I just need to activate a more current version than 2.1. I am currentyl beta testing office 07 as well.


Form Creating Trouble
Heres what I want to do but can't.
Recieve a string from the server split it and get the #--- name (I can do that)
Then I want to make a new form when someone types /join (yes this is an irc chat client, and I can sorta do this)
Then I want the form to be named #--- (whatever the chanel they joined is named) and then refer to it later with something like this:
(Just wont work)
Accessing it and seding it the string:
Code:If InStr(sData, "PRIVMSG #") = 1 Then
    sSplita1 = Split(sData, " ")
    sSplit1 = Split(sData, ":")
    sSplit2 = Split(sSplit1(1), "!")
    sSplit3 = Split(sSplit1(1), ":")
    sFORM.Name = sSplita1(2) '<<<<<DOESNT WORK!
    sFORM.txtBuffer.Text = sFORM.txtBuffer.Text & "<" & sSplit2(0) & ">:" & sSplit1(2)
    'frmMain.txtBuffer.Text = frmMain.txtBuffer.Text & vbCrLf & sData

Then the actual creation code:
Code: If LCase$(Left$(txtChat.Text, 6)) = "/join" Then
            Dim sForme As New frmChat
            sString = txtChat.Text
            sSplit1 = Split(sString, " ")
            sForme.Name = sSplit1(1) '<<<<<<DOESNT WORK!
            sForme.Caption = sSplit1(1)
    End If

If this isnt clear tell me what isnt clear and I'll explain more

Having Trouble Query Access With VBA
This is my first time writing a Access datbase and vba forms. I am having trouble calling the queries in my database. Can you tell me how to create a connection to the database or if I even need to create a connection since the forms are part of the database. Also can you tell me how to call the queries with and without parameters.

Trouble With Grouping On SQL Query
Hi folks,

I'm having trouble getting this query to run correctly.

The database is Microsoft Access.

I am looking at a table called Data, which contains statistics about calls made over a telecom network. There is a record for each call.

AZT is the callerID.
Codes 1 - 14 are different error codes.
ID is the autonumber index of the table (I use to count total calls).

I am trying to return a recordset which contains a total call figure (including errors), a total errors figure, and a count of each error (code 1-14) - all grouped on the AZT.

The query below runs ok, but it's not grouping properly. I've been staring/tinkering at it for hours now and can't figure out why.

The basic query is -

[AZT], [Calls], [Errors], [Code1], [Code2], [Code3], [Code4], [Code5], [Code6], [Code7], [Code8], [Code9], [Code10], [Code11], [Code12], [Code13], [Code14]
LEFT JOIN [tbCalls] ON [Data].[AZT] = [tbCalls].[AZT]
LEFT JOIN [tbErrors] ON [Data].[AZT] = [tbErrors].[AZT]
LEFT JOIN [tbCode1] on [Data].[AZT] = [tbCode1].[AZT]
LEFT JOIN [tbCode2] on [Data].[AZT] = [tbCode2].[AZT]
LEFT JOIN [tbCode3] on [DATA].[AZT] = [tbCode3].[AZT]
LEFT JOIN [tbCode4] on [Data].[AZT] = [tbCode4].[AZT]
LEFT JOIN [tbCode5] on [Data].[AZT] = [tbCode5].[AZT]
LEFT JOIN [tbCode6] on [Data].[AZT] = [tbCode6].[AZT]
LEFT JOIN [tbCode7] on [Data].[AZT] = [tbCode7].[AZT]
LEFT JOIN [tbCode8] on [Data].[AZT] = [tbCode8].[AZT]
LEFT JOIN [tbCode9] on [Data].[AZT] = [tbCode9].[AZT]
LEFT JOIN [tbCode10] on [Data].[AZT] = [tbCode10].[AZT]
LEFT JOIN [tbCode11] on [Data].[AZT] = [tbCode11].[AZT]
LEFT JOIN [tbCode12] on [Data].[AZT] = [tbCode12].[AZT]
LEFT JOIN [tbCode13] on [Data].[AZT] = [tbCode13].[AZT]
LEFT JOIN [tbCode14] on [Data].[AZT] = [tbCode14].[AZT]

Order by [Errors] desc
[Calls], [Errors], and [.Code] 1 - 14 are all sub queries which select the AZT.

Sub queries -- all grouped by AZT.

-[Calls] is a count of records in [Data], grouped by [AZT].
-[Errors] is a sum of records in [Data] where the [Event] field indicates any one of 14 errors. [Errors] is grouped by [AZT].
-[Code(x)] is a count of records in [Data] where the [Event] fields indicates a specific error. These sub queries are also grouped by [AZT].

Full query is below.

If any SQL gurus can decipher the query below, and point out where I'm going wrong, it would be a great help.

select data.[azt], [Calls], (iif([code1] is null, 0, [code1]) +
iif([code2] is null, 0, [code2]) +
iif([code3] is null, 0, [code3]) +
iif([code4] is null, 0, [code4]) +
iif([code5] is null, 0, [code5]) +
iif([code6] is null, 0, [code6]) +
iif([code7] is null, 0, [code7]) +
iif([code8] is null, 0, [code8]) +
iif([code9] is null, 0, [code9]) +
iif([code10] is null, 0, [code10]) +
iif([code11] is null, 0,[code11]) +
iif([code12] is null, 0, [code12]) +
iif([code13] is null, 0, [code13]) +
iif([code14] is null, 0, [code14])) as Errors, [code1], [code2], [code3], [code4], [code5], [code6], [code7], [code8], [code9], [code10], [code11], [code12], [code13], [code14]
from ((((((((((((((data
left join
(Select [azt], Count([id]) as [Calls]
from [data]
group by azt) as tbCalls on data.azt = tbCalls.azt)
left join
(select azt, Count([event]) as [code1]
from data
where [event]='code1'
group by azt) as code1 on data.azt = [code1].azt)
left join
(select azt, Count([event]) as [code2]
from data
where [event]='code2'
group by azt) as tbcode2 on data.azt = tbcode2.azt)
left join
(select azt, Count([event]) as [code3]
from data
where [event]='code3'
group by azt) as tbcode3 on data.azt = tbcode3.azt)
left join
(select azt, Count([event]) as [code4]
from data
where [event]='code4'
group by azt) as tbcode4 on data.azt = tbcode4.azt)
left join
(select azt, Count([event]) as [code5]
from data
where [event]='code5'
group by azt) as tbcode5 on data.azt = tbcode5.azt)
left join
(select azt, Count([event]) as [code6]
from data
where [event]='code6'
group by azt) as tbcode6 on data.azt = tbcode6.azt)
left join
(select azt, Count([event]) as [code7]
from data
where [event]='code7'
group by azt) as tbcode7 on data.azt = tbcode7.azt)
left join
(select azt, Count([event]) as [code8]
from data
where [event]='code8'
group by azt) as tbcode8 on data.azt = tbcode8.azt)
left join
(select azt, Count([event]) as [code9]
from data
where [event]='code9'
group by azt) as tbcode9 on data.azt = tbcode9.azt)
left join
(select azt, Count([event]) as [code10]
from data
where [event]='code10'
group by azt) as tbcode10 on data.azt = tbcode10.azt)
left join
(select azt, Count([event]) as [code11]
from data
where [event]='code11'
group by azt) as tbcode11 on data.azt = tbcode11.azt)
left join
(select azt, Count([event]) as [code12]
from data
where [event]='code12'
group by azt) as tbcode12 on data.azt = tbcode12.azt)
left join
(select azt, Count([event]) as [code13]
from data
where [event]='code13'
group by azt) as tbcode13 on data.azt = tbcode13.azt)
left join
(select azt, Count([event]) as [code14]
from data
where [event]='code14'
group by azt) as tbcode14 on data.azt = tbcode14.azt

Cheers guys.


Trouble With The Date In A SQL Query
Hi there, hoping someone can point me the right way before I pull out what little hair I have left.

In VB6, I've got a data control linked to an access database. I'm using a SQL statement as the RecordSource of the data control.

The SQL statement I'm using is this: -
SELECT * FROM [Order] WHERE DateVal >#dd/mm/yyyy#

It's being dynamically created by the following code (where the object ca is a calendar control): -
Private Sub Command1_Click()
vSQL = "SELECT * FROM [Order] WHERE DateVal >#" & ca.Value & "#"
Data1.RecordSource = vSQL
Data1.Refresh 'I think this bit is necessary but I'm not entirely sure why
End Sub

The data in the table called Order looks like this (DateVal is a field of a date/time that is populated using the vb function
519/04/2005 22:19:2622.38
619/04/2005 22:19:37289.83
720/04/2005 19:27:23996.23
820/04/2005 19:43:071,115.06
2820/04/2005 19:56:3736.98
2920/04/2005 20:06:321,089.30
3020/04/2005 20:12:391,089.20

OK, the trouble that I am having is that I am getting really inconsistent results. If I select a date from 01/04/2005 to 04/04/2005 it returns the expected rows. The same for dates from 13/04/2005 to 21/04/2005. However if I select a date from 05/04/2005 to 12/04/2005 I get no results returned. This just doesn't make sense to me. Does anyone know what is going on?

I've just manually built the same SQL queries in Access and it's doing the same. I don't understand it.

[Another EDIT]
I've just edited the data to have a wider range of days in the access database. The following SQL query: -

FROM [Order]
WHERE DateVal >#03/04/2005#;

Returns data including the following row: -
2602/04/2005 19:56:23

This is just blatantly wrong now. Sorry if I've gone a bit off topic here, seems more like an access/SQL issue than a VB one.

Trouble With Joins In SQL Query
I posted this one in the access modules forum also. I thought it may be more appropriate/useful in this forum as well. Hopefully I'm not p***ing anyone off by posting it in two forums.
I have an SQL string that I am using to populate a grid in VB 6 (from an access 2003 .mdb) with the user having the ability to filter the grid based on the values in some text boxes. (these are the string variables at the bottom of the code). I am having a problem with one area of the statement. Here is the code:

CODESELECT Quote.Quote_ID, Project.Project_Number, Quote.ELM_version, Customer.Customer_Name, Site.Site_Location, Quote.Scope, Quote.Quote_Due_sales, Quote.Quote_complete, Quote.Quote_Total, Quote.Comments, PDM.PDM_LastName, Quote.RFQ_Sent_PM_Date, PM.PM_LastName, PM.PM_Hours, PM.PM_Travel, Quote.PM_Quote_Total, Quote.PM_Quote_Complete, Quote.RFQ_sent_SYS_date, Systems_Engineering.Sys_Estimator_LastName, Systems_Engineering.Sys_Hardware, Systems_Engineering.Sys_Resale, Systems_Engineering.Sys_Travel, Systems_Engineering.Sys_Hours, Systems_Engineering.Equip_list_done, Systems_Engineering.Dwgs_done, Systems_Engineering.Sys_Quote_Complete, Quote.Sys_Quote_Total, Quote.RFQ_sent_Ctls_date, Controls.Ctls_Estimator_LastName, Controls.Ctls_Hardware, Controls.Ctls_Tranships, Controls.Ctls_Resale, Controls.Ctls_Travel, Controls.Ctls_Hours, Quote.Ctls_Quote_Total, Controls.Ctls_Quote_Complete, Quote.RFQ_sent_SAE_date, SAE.SAE_Estimator_LastName, SAE.SAE_Hours, SAE.SAE_Hardware, SAE.SAE_Resale, SAE.SAE_Travel, Quote.SAE_Quote_Total, Quote.SAE_Quote_Complete, Quote.RFQ_sent_Mech_Inst_date, Mechanical_Installation.Mech_Inst_Estimator_LastName, Quote.Mech_Inst_Quote_Total, Quote.Mech_Inst_Quote_Complete, Quote.RFQ_sent_Elec_Inst_date, Electrical_Installation.Elec_Inst_Estimator_lName, Quote.Elec_Inst_Quote_Total, Quote.Elec_Inst_Quote_Complete, Quote.RFQ_sent_ISE_date, Quote.ISE_Estimator, Quote.ISE_Quote_Complete, Site.DC_Num, Quote.Date_Rcvd, Quote.Quote_Type, Quote.Base_CheckBox, Quote.Alt_CheckBox, Quote.CCQR_CheckBox, Quote.New_DC_CheckBox, Quote.Retro_CheckBox, Quote.Enhance_CheckBox
FROM Site INNER JOIN (((((((((Quote LEFT JOIN Controls ON Quote.Quote_ID = Controls.Quote_ID) INNER JOIN Customer ON Quote.Quote_ID = Customer.Quote_ID) LEFT JOIN Electrical_Installation ON Quote.Quote_ID = Electrical_Installation.Quote_ID) LEFT JOIN Mechanical_Installation ON Quote.Quote_ID = Mechanical_Installation.Quote_ID) LEFT JOIN PDM ON Quote.Quote_ID = PDM.Quote_ID) LEFT JOIN PM ON Quote.Quote_ID = PM.Quote_ID) LEFT JOIN Project ON Quote.Quote_ID = Project.Quote_ID) LEFT JOIN SAE ON Quote.Quote_ID = SAE.Quote_ID) LEFT JOIN Systems_Engineering ON Quote.Quote_ID = Systems_Engineering.Quote_ID) ON Site.Site_ID = Customer.Site_ID
WHERE (((Project.Project_Number) ALike '” & sProject1 & “') AND ((Quote.ELM_version) ALike '” & sRev1 & “') AND ((Customer.Customer_Name) ALike '” & sCustomer1 & “') AND ((Quote.Scope) ALike '” & sScope1 & “') AND ((Customer.Customer_Location) ALike '” & sLocation1 & “'));

Trouble Creating All Possible Arrangements Of 6 Letters
I have downloaded a list of all the 6-letter words in the dictionary, now I want to take a user-input of a scrambled 6-letter word, rearrange it, and check through the dictionary list to see if there's a match. Basically, I play Text Twist too much, and I hate losing only to find out that the word I needed was something crazy like "rimose."

Back to the problem, I already have a function/method which checks through the list of dictionary words for a match, but I need some arrangement of For-Next loops to create every possible arrangement of the given 6 letters.

Thank you

Trouble Creating An Access Table With VB6
Hi Everyone,

I was given some code to do this yesterday, however I ran in to a problem. When I use the
same format that was posted, changing the names, and lengths to suit the table I need I
get an error message when I move to the next line.

"Expected end of statement" with the name of the table to be created highlighted.

Any suggestions?

Trouble When Creating Chart Using MsChart
hii all gurus,
I can't make chart using mschart component.,
I can make this using excel,
-Using xy scatter chart type,
-Make two series, each series has its x values and y values
  i use this value : series1 : x = 10 & 20 and y = 80 & 60
     : series2: x = 25 & 20 and y = 75 & 50
that will make two line crossed, and creating a center/cross point.
how make this using mschart ?, i dont know how to use its property, i 've tried several times but always failed...
i dont know how to make and enter that series (series1 & series2).
if you know some, please teach me something.... i'd really appreciate it , i've stuck for weeks...
Thank You Very Much...,
have a nice weekend,

Trouble Creating An Index In A TableDef
Hey. I am trying to follow the DAO 3.6 help file's recommendations for establishing an index in a TableDef object, but it keeps telling me that '"" is not a valid name.' Error 3125, I think. What am I doing wrong here? I've tried moving the structures around (setting the index outside of the "With td" block, etc.) but that only results in other error messages. Thanks!

Code:Private db As Database
Private rs As Recordset
Private td As TableDef
Private idx As Index

Set db = Workspaces(0).OpenDatabase("C:workStaffPrinter.mdb")
Set td = db.CreateTableDef("SymbolLocations")
With td
   .Fields.Append .CreateField("SYMBOLCLS", dbLong)
   .Fields.Append .CreateField("SYMBOLTYPE", dbLong)
   .Fields.Append .CreateField("CODENUM", dbText)
   .Fields.Append .CreateField("PAGENUM", dbLong)
   Set idx = .CreateIndex
   With idx
      .Fields.Append .CreateField("ORDER", dbLong)
   End With
   Call .Indexes.Append(idx)
   .Fields.Append .CreateField("STAFFAMT", dbLong)
   .Fields.Append .CreateField("GTRSTAVES", dbLong)
   .Fields.Append .CreateField("BASSSTAVES", dbLong)
   .Fields.Append .CreateField("MEASURES", dbLong)
   Call db.TableDefs.Append(td) '(THIS IS THE ERROR LINE!!!)
End With
Set rs = db.OpenRecordset("SymbolLocations", dbOpenTable)
rs.Index = "ORDER"

HELP!! Creating A Custom IE And Having Trouble With Favorites List.
HELP!! Creating a Custom IE and having trouble with Favorites List.

I hope anyone can help me with this problem. I'm doing this program for one of my homework and I'm having trouble storing and retreiving the Favorites List once its added.

Here is my code:

Private Sub MNUFavorites_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MIAddFavorites.Click

If TXTUrl.Text.Trim() = "" Then
MessageBox.Show("Blank URL, Unable to Add to Favorites")
Exit Sub
End If

MNUFavorites.MenuItems.Add( _
New FavoritesMenuItem(TXTUrl.Text))

Dim file As New System.IO.StreamWriter("Favorites.txt", True)
End Sub

Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


Dim file As New System.IO.StreamReader("Favorites.txt")
While True
Dim links As String
links = file.ReadLine
If links Is Nothing Then
Exit While
End If
End While
Catch ex As Exception
End Try
End Sub

Here is my Sub-Class for FavoritesMenuItem:

Private STRUrl As String

Public Sub New(ByVal Url As String)
STRUrl = Url

End Sub

Protected Overrides Sub OnClick(ByVal e As System.EventArgs)
Dim myform As MainForm
myform = CType(Me.GetMainMenu().GetForm(), MainForm)

myform.TXTUrl.Text = STRUrl

End Sub
End Class

*** When storing the URL, the URL is stored but only the TITLE of the URL should be displayed on the Menu Item Favorite button. Any ideas? Please help. I've been doing this for 3 nights already.



Trouble Loading/creating Multiple Imagebox
I can't figure out why this only creates 1 extra image box. any ideas?

Private Sub Form_Load()
Dim i As Long
For i = 1 To 8
Load ImageBox(i)
With ImageBox(i)
.Move ImageBox(i - 1).Width, 0, 97, 97
.Visible = True
End With
Next i
End Sub

Private Sub ImageBox_Click(Index As Integer)
Debug.Print Index
End Sub

Creating CAB Files (Trouble With INF While (not) Adding Registry)
I could not add anything manuelly (except registerserver=yes working) to registry from the webpage but I can do the adding part from windows explorer right click and install to inf file.

I want to add my activex control to be worked as a safe activex control. "registerserver= yes" works but I can not add something to my main class.. Here is the code..

; version signature (same for both NT and Win95) do not remove



[Setup Hooks]



HKLM,"SOFTWAREClassesCLSID{39D72F54-4786-4155-AC5F-9B77CF0B5525}Implemented Categories{7DD95801-9882-11CF-9FA9-00AA006C42C4}"
HKLM,"SOFTWAREClassesCLSID{39D72F54-4786-4155-AC5F-9B77CF0B5525}Implemented Categories{7DD95802-9882-11CF-9FA9-00AA006C42C4}"

Trouble With SQL Query With User Textbox Entry
I have searched the forums forward and backward and cannot find just what i am looking for. Here is some code I am working with. It is modified from another programmers code. I just can't seem to get the statement to accept the users textbox entry to query the database after connect; and return the closest values in my MSFlexgrid. I have had success returning all of the records, but not a query for a specific record. I would like to see the grid update as I type letters in for the search. Any help would be tremendously appreciated. Must I make use of an array. I am not to great with arrays.

Private Sub txtPartNumber2_KeyPress(KeyAscii As Integer)

Dim oRs As New ADODB.Recordset
On Error GoTo errFillGrid
Dim txtPartNumber As String

If Connect() Then


Thanks In Advance,


Query Running In Access But Giving Trouble In Vb
Hey all,
I have the following query

[vb]strSql = "Select * From 36hourquerybig where Component Like '" & cboComponent.Text & "*'" & _
"And family Like '" & lstfamily.Text & "'"[vb]
In my immediate window it reads

[vb]Select * From 36hourquerybig where Component Like '16600655640300*'And family Like '51124xx'[vb]
If I run this in Access it retrieves 9 records for me (I take this to mean that my syntax is ok??).However in my ado code it stops working at the highlighted line.

Private Sub cmdComp_Click()
Dim strSql As String

Set rsTrolly = New ADODB.Recordset

If rsTrolly.State = adStateOpen Then
End If

strSql = "Select * From 36hourquerybig where Component Like '" & cboComponent.Text & "*'" & _
"And family Like '" & lstfamily.Text & "'"

Debug.Print strSql

If cboComponent.Text = "" Then
MsgBox "you must select a family"
With rsTrolly
.CursorLocation = adUseClient
.Open strSql, dbConn

If .RecordCount > 0 Then 'stops here
frmSelection.txtComponent.Text = !component
frmSelection.txtABC.Text = ![ABC Code]
frmSelection.txtReelSize.Text = ![Reel Size]
reelsize = frmSelection.txtReelSize.Text '.....and so on
and its telling me my .RecordCount is in fact 0.Anybody know why my query works in access but not in my code.No errors are just doesnt go into the code after the if..


Creating A .ini File For Info Use
I'm making a MMORPG and i want to know how to have a .INI file created when a new character is made, that contains the player name, password and other information. In a manner like this: new player: Suminex



Name= Suminex
Class= Fighter
Sex= Male
Quests= 0

Of course the name, class, sex, and all that would be changed accordong to what the user chooses in the character creation form
I would also need my program to retreive this info from my computer to verifiy login and password compatibility, I am very new to Vb ( a couple months) and i need alot of help, so if someone could clearly explain this to me id be very happy

Creating Tables
Edit by herilane: Split from hereHi,Supa-Fly,
It is very helpful your last post to my project now.

But i encountered a big problem now.....
In my project i need to create around 50-100 tables in the document.
I have problem to create mutiple tables..

In my program i coded like this to create multiple tables:
'create the nTH table
Call AddTable(oDoc, oRange, n, 9, 2)

'add space between the tables
oDoc.Tables(n).Select 'select the table we just create

Selection.MoveDown Unit:=wdLine, Count:=2 ' move the cursor down
Selection.TypeParagraph 'add two blank paragraphs
Set oRange = Selection.Range 'define new oRange

'create the (n + 1)TH table
Call AddTable(oDoc, oRange, (n+1), 9, 2)
The problem is that my codes can not always excute well.
Sometimes, the next table will be created inside the cell of the previous table.
If change the number of "Selection.TypeParagraph", there will be error-free, or the error will occur at another place...
And this error will stop the excution of the program.

It seems impossible to generate such error from my codes.
Is there any good idea to add space between two tables....

Really appreciate your helpful reply........
I have to submit the project this friday and do the Demo also....

Many thanks to you, ...........


Creating Tables
I'm trying to write several macros to create tables with particular attributes in the individual cells (font size, bold, width etc).
This seems to work but I need the tables several times in the same document. When I use the macro a second time it creates a new table but the formatting (font size ...) is applied to the first table not the new one.
How can I code the macro so the formatting applies to the new table and not the original?

I hope my question is clearly explained, I can show the code if it helps
(but haven't here because of space).



Creating SQL Tables With VBA
I'd like to create tables with VBA. Anyway it doesn't seem to work when I try to add variables in it.

For example:

With table
Do While Not .EOF
DoCmd.RunSQL "CREATE TABLE " + !variable + " (blah blah);"
End With
This just gives me syntax error.

Copyright 2005-08, All rights reserved