Retrieve POS data

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Dec 2008
Posts: 21
Reputation: sackymatt is an unknown quantity at this point 
Solved Threads: 0
sackymatt sackymatt is offline Offline
Newbie Poster

Retrieve POS data

 
0
  #1
Jul 13th, 2009
Hi guys

am new on VB6 and would like your urgent help, i have created my POS half way and have created a form for sales, now what i want is when i enter an item code all the other information related to the item diplays at the respective text boxes..

please help
regards
Sacky
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 835
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 152
vb5prgrmr vb5prgrmr is offline Offline
Practically a Posting Shark

Re: Retrieve POS data

 
0
  #2
Jul 13th, 2009
Use the data form wizard. Search my handle and those keywords to learn how to invoke it, use it, and what to do with it.


Good Luck
If anyone has helped you solve your problem, please mark your thread as solved.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 17
Reputation: johnly is an unknown quantity at this point 
Solved Threads: 4
johnly johnly is offline Offline
Newbie Poster

Re: Retrieve POS data

 
0
  #3
Jul 16th, 2009
Place a data control on the form
Set the database and recordsource propery of the data control
Then place the text boxes to display the values.

Select the datasource property of each text box and set it to the data control.

Now set the datafield property of each textbox to the desired field name.
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 21
Reputation: sackymatt is an unknown quantity at this point 
Solved Threads: 0
sackymatt sackymatt is offline Offline
Newbie Poster

Re: Retrieve POS data

 
0
  #4
Jul 17th, 2009
thanx guys for ur help..
i will follow all u telling me and see if i can archieve anything and come back to you

Sacky
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 21
Reputation: sackymatt is an unknown quantity at this point 
Solved Threads: 0
sackymatt sackymatt is offline Offline
Newbie Poster

Re: Retrieve POS data

 
0
  #5
Jul 17th, 2009
hi johnly, i did exactly like how instructed and it worked very well.. but this does not allow me to enter the item code myself and retrieve the data associated to the item code.when i run the form, it automatically fills the areas with the data.
what i want is when i enter the item code, it matches with the one in the database and then retrieve the rest of the data associated to that item code.
for example, when i enter 2000 in the item code area, it matches that one with the one in my database and return the price, item name and tax associated to that item in the respective areas

Any further assistance will be appreciated
Sacky
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 17
Reputation: johnly is an unknown quantity at this point 
Solved Threads: 4
johnly johnly is offline Offline
Newbie Poster

Re: Retrieve POS data

 
0
  #6
Jul 17th, 2009
Gr8...

For this you can add a new textbox called (txtItemCode). dont link it with the data control.

Now you can write the following code in the change event of this new textbox.

If the item code data type is text then you can write:

Private Sub txtItemCode_Change()
Data1.RecordSource = "select * from table1 where itemcode = '" & txtItemCode.Text & "'"
Data1.Refresh
End Sub


or if the datatype of the code in database is number the you can write the below

Private Sub txtItemCode_Change()
Data1.RecordSource = "select * from table1 where itemcode = " & val(txtItemCode.Text)
Data1.Refresh
End Sub


Pls note that you need to replace the table name (table1) and fieldname (itemcode) with the actual tablename and field name in your database.
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 835
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 152
vb5prgrmr vb5prgrmr is offline Offline
Practically a Posting Shark

Re: Retrieve POS data

 
0
  #7
Jul 18th, 2009
Only problem with that johnly is using the change event of the textbox. As the lookup code (number/alpha) gets longer your code will be executed each time there is a change! Which means for a four digit code, your code will pound the datbase four times with your look up query! Better to put the actual search under a command button (or perhaps the lost focus event of the text box if you want a high amount of automation).

sackymatt,

Have you even tried the Data Form Wizard and see what code it generates for you?


Good Luck
If anyone has helped you solve your problem, please mark your thread as solved.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 21
Reputation: sackymatt is an unknown quantity at this point 
Solved Threads: 0
sackymatt sackymatt is offline Offline
Newbie Poster

Re: Retrieve POS data

 
0
  #8
Jul 18th, 2009
Thanx guys again, i really appreciate your time in this forum..
Fistly Jonhly, i tried the code in the txtcode box and when i run the form and try to enter the item code (barcode) a 'run time error '424' object required' keeps on popping up.
I also tried it in a command button, still the same error pops up.
in debug mode, it highlights the following
<code>
Private Sub txtcode_Change()
Data1.RecordSource = "select * from items where barcode = " & Val(txtcode.Text)
Data1.Refresh
End Sub
</code>

Does this have to do with the connection maybe? i have my database on ms access though.

vb5prgrmr,
How do i use Data Form Wizard? Please elaborate more if possible,
Thanx
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 835
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 152
vb5prgrmr vb5prgrmr is offline Offline
Practically a Posting Shark

Re: Retrieve POS data

 
0
  #9
Jul 19th, 2009
Start a new standard exe project>vb's ide menu>Add-Ins>Add-In Manager.
Hightlight VB 6 Data Form Wizard
Lower right corner of form where frame with caption says Load Behavior put a check in the box next to Loaded/Unloaded>click Ok

Add-Ins>Data Form Wizard
Follow wizard enough times to get every combination of form type along with code/class/control.
Save project for future reference.


Good Luck
If anyone has helped you solve your problem, please mark your thread as solved.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 17
Reputation: johnly is an unknown quantity at this point 
Solved Threads: 4
johnly johnly is offline Offline
Newbie Poster

Re: Retrieve POS data

 
0
  #10
Jul 19th, 2009
Hi sackymatt,

Please check the following.

1. Is the name of your search textbox is (where you are entering the barcode) txtCode ?

2. Is the name of your data control is Data1 ?

3. The RecordsetType property of the data control should not be 0 - Table. It can be 1 - Dynaset or 2 - Snapshot.

You can have it as 2 - snapshot if you do not want to edit the values, and just want to view it.

I agree with Vb5Prgmr that there is a performance issue if you call the code in the change event of the textbox. Instead you can write this code in the click event of a commandbutton.

You can write the code in change event if you require the values to get automatically loaded in the textboxes when you type the code in the search textbox. But the other method (using a button) is preferrable if the table contains a large number of records.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC