Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a Combo Box

Status
Not open for further replies.

ggrewe

IS-IT--Management
Jul 10, 2001
169
0
0
US
I have a comboBox and its row source is an alias to a query. The query is a subset of records from the same table that I am adding records to. When I add a new record to a table and and try to re-run the select-sql statement, I get a message that says "Cannot access the selected table". The control will then disappear from the form. I know the problem happens when I drop the cursor and re-issue the select statement. I tried just doing a requery(), but the response is something like "cannot requery a natural table", but the table is a query that I used the into cursor command. How can I avoid this and still be able to use the requery command?
 
Hi
Suggest you open the same table twice.. example
USE MyTable IN 0 Alias myTable
USE MyTable IN 0 Alias myTableQ

Now in the select statement said above, use myTableQ

When you are adding record, the table might have been locked and that is the reason you get the error.

Alternative suggestion... change the buffer mode to optimistic locking... but still this could land you in trouble since the record poibters are getting moved. So opening the table again for query purpose separately is the best suggestion according to me.

Hope this helps. ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
LET KNOW IF THIS HELPED. ENOUGH EXPERTS ARE HERE TO HELP YOU OUT! BEST OF LUCK :)
 
Thanks Ramani, I already tried that with the same result. What I am doing now is just using a view from that built in the database designer and using the requery command there. Anything else I have tried seems to give me the same error.

Thanks again and enjoy the rest of the weekend.
 
HI
Good you used a view. There is an error in my code and that is why it might not have worked. That is..

USE MyTable IN 0 Alias myTable
USE MyTable IN 0 AGAIN Alias myTableQ

using AGAIN is important.


ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
LET KNOW IF THIS HELPED. ENOUGH EXPERTS ARE HERE TO HELP YOU OUT! BEST OF LUCK :)
 
Hello.

Try to save the recordsource in a local variable, redo the query, then assign the recordsource back to the combo.

Then, if necessary, REQUERY() the combo.

It should work.

Hope this helps, Grigore Dolghin
Class Software
Bucharest, Romania
 
I have a problem with a column in Grid.

The first column of grid is Item code. What I want is if I press Item Code Blank, the message should appear like "Do you finish your entry ?" if by pressing "Yes" it should go to another control on a form like "Discount" etc. and in case of "NO" cursor should go back to Item Code. Can U help me.

Thanx

Saif
 
Saif,
First this question should really be the start of a new thread, it's unlikely many people will expect a question on a grid under a topic of "Using a Combo Box".

Second, using a grid for data entry can cause a lot of trouble (especially for new VFP programmers), perhaps you should rethink this form design.

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top