marlon ng 0 Newbie Poster

Hello. The code below is for a program that uses the classis Access sample database called Biblio.mdb . The controls on the form are: 1 commmand button, 1 Datagrid control, 1 textbox, and 1 ADO Data Control.

Option Explicit

Private Sub Form_Load()
 txtUserQuery.Text = Adodc1.RecordSource
 Adodc1.Caption = Adodc1.RecordSource
End Sub

Private Sub cmdQuery_Click()
 On Error Resume Next
 cmdQuery.Enabled = False
 Adodc1.RecordSource = txtUserQuery.Text
 Call Adodc1.Refresh
 Adodc1.Caption = Adodc1.RecordSource
End Sub

Private Sub Adodc1_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
 cmdQuery.Enabled = True

My question is, why use the event MoveComplete? How does it differ from
RecordsetChangeComplete and RecordChangeComplete??? I've already read
their definition but I can't tell them apart. I've also tried
substituting it with the other two Events but they don't work. Can you
give me a simple program that uses RecordsetChangeComplete and
RecordChangeComplete? If not, please explain them in layman's terms.
Beginner here. thanks guys!!!!
End Sub

marlon ng 0 Newbie Poster

Hello. In the classic database example, Biblio.mdb, the relationship between 'TITLES' AND 'TITLE AUTHOR' tables does NOT enforce referential integrity. Please explain to me why. I'm kind of a beginner so please make your explanation as simple and clear as possible. Thanks a lot guys!!!

marlon ng 0 Newbie Poster

Hi. Im a beginner and I've recently studied ASSIGNING ARRAYS and have drawn the following conclusions. Please tell me if they're correct or not. If their wrong, pls explain to me why they're wrong and pls give me a sample code. Thanks a lot guys!!!

Assign fixed array to dynamic array = CAN BE DONE
Assign dynamic array to dynamic array = CAN BE DONE

Assign fixed array to fixed array = CANNOT BE DONE
Assign dynamic array to fixed array = CANNOT BE DONE

marlon ng 0 Newbie Poster

Hi. Pls copy paste this to your form module.

Option Base 1
Private Sub Command1_Click()
 
 Dim mArray(15) As Integer
 
 For x = LBound(mArray) To UBound(mArray)
  Print Format(x, "!@@@@@@");
 Next x
 Print
 
 For x = LBound(mArray) To UBound(mArray)
  Print Format(x * 2, "!@@@@@@");
 Next x
 
End Sub

There's a command button on the form, that's it.

I got this example from a book but it seems flawed. The first line that appears on the form when you click the button are numbers 1 to 15. The numbers on the second line is derived by multiplying the numbers on the first line by 2.

My problem is this: the numbers on the first line and the numbers of the second line should be aligned vertically. As you can see, the first five columns, (i.e. 1 2 3 4 5 on the first line and 2 4 6 8 10 on the second line)
are aligned just fine, but the rest are a mess. How do I align all of them???

Thanks a lot guys!!!

marlon ng 0 Newbie Poster

I got this from a book.:
Forty students were asked to rate the quality of the food in the student cafeteria on a scale of 1 to 10 (1 means awful and 10 means excellent). Place the 40 responses in an Integer array and summarize the results of the poll.

The form has a command button named cmdPrint. Here is the code:

Option Explicit
Option Base 1
Dim mResponses(40) As Integer

Private Sub Form_Load()
Dim x As Integer

For x = LBound(mResponses) To UBound(mResponses)
mResponses(x) = 1 + Int(Rnd * 10)
Next x
End Sub

Private Sub cmdPrint_Click()
Dim frequency(10) As Integer '10 elements
Dim x As Integer

Call Cls
Call Randomize

'Calculate results
For x = LBound(mResponses) To UBound(mResponses)
frequency(mResponses(x)) = frequency(mResponses(x)) + 1
Next x
Print "Rating" & Space(3) & "Frequency"
For x = LBound(frequency) To UBound(frequency)
Print Space(3) & x & vbTab & vbTab & frequency(x)
Next x
cmdPrint.Enabled = False
End Sub

I don't understand the logic of this line:
frequency(mResponses(x)) = frequency(mResponses(x)) + 1
I've read the book's explanation over and over but I still don't get it.
Here is what the book says: "This statement increments the appropriate frequency counter depending on the value of mResponses(x). For example, when the counter x is 1, mResponses(x) is 1, so frequency(mResponses(x) is actually interpreted as frequency(1) …

marlon ng 0 Newbie Poster

If I uncheck the AllowZeroLength, wouldn't that have the same effect as checking Required?
Please correct me if I'm wrong. I'm having a hard time differentiating the two.

If a Customer table contains a Phone No. field, and I'm about to add a new customer who doesn't have a phone number, and the AllowZeroLength is UNCHECKED, then that means I have to type something in the Phone No. field, right? But isn't that the same as CHECKING Required? (Required means data entry is required, i think)


Thanks!

marlon ng 0 Newbie Poster

Hi! Beginner here. I'm using VB 6.0 . I created a new Access database (.mdb) using Visual Data Manager (from Add-Ins). If I right-click on a blank space in the Database Window, and click New Table in the context menu, a Table Structure window would appear. In it, I'm supposed to enter data into some textboxes and choose which checkboxes to check, but I don't understand what they mean. Here are my questions:

1. I know that 'Size' refers to the maximum number of characters that can be entered. What does checkboxes 'FixedLength' and 'VariableLength' mean in relation to 'Size'?

2. What is 'CollatingOrder'?

3. What is 'AllowZeroLength'?

4. There is a 'Required' checkbox, what exactly is it refering to? Is it refering to the 'OrdinalPosition'? Because it is beside 'OrdinalPosition'.

5. What is 'ValidationText', 'ValidationRule', and 'DefaultValue'?

6. What is an Index? What should be in the 'Index List'? Why is 'PrimaryKey' in the Index List? (in one of the tables in the Biblio.mdb example provided by MS)

7. What do these checkboxes mean: Unique, IgnoreNull, Foreign?

8. In Visual Data Manager, if I open the Biblio.mdb file, then right-click the Authors table and click 'Design', the data provided in the 'Fields:' textbox is '+Au_ID' . Why is that?

That's it for now. Thanks a lot guys!!!

marlon ng 0 Newbie Poster

By the way, if you were to make a program like the one I stated, what type of programming would you do? I know the question is kind of vague, but I just want to get an idea. The program would have a database of customer names, products, etc. etc.. It would basically be a program that handles EVERYTHING, from order-taking to delivery-scheduling to managing receivables and payables. Thanks again!!

marlon ng 0 Newbie Poster

Thanks a lot WaltP! Appreciate it!

marlon ng 0 Newbie Poster

I'm a beginner so pls bear with me. Try to make your explanations as simple as possible. The program i'm going to make will be like this: the user enters the customer name, the items ordered by the customer, the quantity of those items, and their prices. Here are my questions:

1. Do I really need to build and incorporate databases from softwares like Access to my VB program? Or are there other alternatives? Because I don't like my program to be dependent on other software.

2. I'm sure you experts are familiar with Clipper. It doesn't rely on databases created from other software (I think). Is this possible with VB6? How do I do it then? By using random access files (.rnd)?

3. If I use .rnd files, can I still use the ADO Data Control, Datalist, DataGrid and DataCombo controls of VB6?

That's it for now. Pls help me!! I already know the basics of VB, I just need to know the best and simplest approach in creating the program I stated above. Thanks a bunch!!!!